-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show API documentation at /api/ #2650
Conversation
It is shown in development, but not in production and can be turned on/off with config.featureFlags.apidocs Generated with swagger-autogen Displayed with Swagger-UI v5.9.0 https://github.com/swagger-api/swagger-ui The documentation gets updated in pre-commit hook
to get rid of workflows error
Tried it locally, looks fine to me (although I have no idea what I should see :) ) |
If you go to http://localhost:3000/api/, you should be able to see the Swagger documentation of Trustroots API |
Yes, that works! |
Ok, great! Thank you for testing @JohnvdWaeter! |
Proceeding with the merge, since b7b9725 was deployed. ✅ |
It is shown in development, but not in production and can be turned on/off with config.featureFlags.apidocs Generated with swagger-autogen https://www.npmjs.com/package/swagger-autogen Displayed with Swagger-UI v5.9.0 https://github.com/swagger-api/swagger-ui The documentation gets updated in pre-commit hook
Proposed Changes
npm run generate-api-docs
(the documentation isn't perfect, but it's good enough, much better than doing it manually) using swagger-autogen/api/
path{ featureFlags: { apidocs: true } }
in./config/env/local.js
The OpenAPI json, and files for Swagger-UI are stored in /apidocs/ folder. It can be moved elsewhere if somebody prefers
Motivation
For people who want to develop e.g. mobile app on top of Trustroots API, this can be useful resource
Testing instructions
Update node_modules by running
npm ci
Try to delete
/apidocs/openapi.json
, then runnpm run generate-api-docs
, and it should re-appearRun the app locally, and go to http://localhost:3000/api/, and you should see
If running the whole app locally is too much for you, you can
sudo npm install -g http-server
git switch api-docs
cd apidocs/
http-server