swagger-ui を使用して API を表示するには、次のいずれかを実行します。
オプション 1: オンラインの swagger-ui を使用する
- これに行きます。
- ページ上部のダイアログ ボックスで、swagger-json の URL を指定します。あなたの場合、http://petstore.swagger.io/v2/swagger.json (デフォルトで表示されます)の代わりにhttp://localhost:3001/api-docsを挿入し、 Exploreをクリックします。
- これで、API 用に生成された swagger-ui を確認できます。
オプション 2: swagger-ui プロジェクトをローカルでセットアップする
swagger-uiを設定する必要があります。以下の手順に従って、プロジェクトのセットアップを複製できます。
Windows Users: Please install Python before follow below guidelines
for node-gyp rebuild to run.
1. npm install
2. npm run build
3. You should see the distribution under the dist folder. Open ./dist/index.html to launch Swagger UI in a browser
Development
Use npm run serve to make a new build, watch for changes, and serve the result at http://localhost:8080/.
これで、 online swagger-uiとまったく同じものが表示されるはずです。
オプション 1 と同じことを実行して、swagger-json の URL を提供し、生成された swagger-ui を確認します。