How to enable Swagger interface in Azure Easy API

I use Azure App Services and configure the Easy API using the Easy Table for the backend API for my mobile phone.

I was wondering how to set up Swagger user interface for Azure App Service.

When I try to switch to the API (for example, https://xxxxxx.azurewebsites.net/swagger/ui ), it says: "To access the swagger user interface, you must enable swagger support by adding a swagger: true for your configuration and installation swagger-ui npm module "

How exactly do you add swagger-ui npm when you don’t have a source for the API (it is created automatically using the Easy API)?

+4
source share
2 answers

Two parts of your question:

1) Enabling Swagger in EasyAPI is not possible right now. That is, we do not integrate and do not generate Swagger for EasyAPI, since all parameters are defined in the code.

2) If you want to enable Swagger, you need to add 'swagger: true' to the Azure Mobile Apps initializer in the app.js file at a level higher than your API. Go to Easy API or Easy Tables and edit any API / table. This will call the editor. Go to the directory above (the one that contains the api and tables directories) and edit the app.js. file there.

+3
source

Stages:

  1. On the Azure Portal
  2. Open the application service of your application
  3. β†’ ( ) - GO
  4. ( ) β†’ (CTRL + Shift + C)
  5. npm install --save swagger-ui
  6. , node_modules β†’ swagger-ui
  7. swagger /wwwroot/app.js

:

var mobile = azureMobileApps ({   // Azure   homePage: ,

// Explicitly enable swagger support. UI support is enabled by
// installing the swagger-ui npm module.
swagger: true

});

  1. Swagger https://your-application.azurewebsites.net Google Chrome, , https://your-application.azurewebsites.net/swagger/ui
0

Source: https://habr.com/ru/post/1648842/


All Articles