Swagger — JSON documentation on a simple calculator API
To start we will need a simple calculator api to then document.
To keep it simple here is how your folder structure needs to look like.

Then we will add the following packages with npm.
npm i -s swagger-ui-express express
Now our main.js (index.js) code:
routes.js:
controller.js:
Now lets tackle the swaggerdoc.json in parts.
1st we need to give the project a description:
2nd, in order to not repeat ourselves in each endpoint with what could be a lot, we create a schema component.
3rd we can now start making the endpoints actual documentation.
This is the example for the sum its easy to get the rest from here.
Here is the whole swaggerdoc if you for some reason feel like you need it.