There are 2 main folder structures in api directory.
Client: Client has all the files needed for Swagger Docs.
Server: Here you can see all the API modules and their setting and connections.
Inside the API directory, you can see several module menuItem, Category, etc. Each module has there own API and their route, controller files. Let's take the example of Category modules.
It contains all the route or API for those modules. We defined API URL path and their controller function corresponding to that route and with user access like which route access by user or admin or if we can see any different role we can assign there.
You can see, it has all the function controller that we defined in our API route index.js. Each API get or post and there DB query implement within that function. Function run all the business logic needed and return JSON to the client.
We use this file for EventEvent based logic. Let's say somewhere we need a do something once any data save into DB or we want to trigger any event if DB update. It mostly used with the socket. We have used this EventEvent based mechanism in some module like Chat and Notification.
We defined all the Data model Schema and their type inside this file. We are using Mongoose to validate our Data model.
If there any event occurs like save/update we can connect our socket event with it. We create a socket event and trigger if any model event happen.
Inside API > auth directory we do all the user authentication. Passport module is used for user authentication. We have four authentications Local for regular email, password-based authentication. Facebook, G+, Twitter used for social authentication. You can add any other authentication as needed.
Inside API > config > environment directory you can update MongoDB URL and nodeJS ENV like development or production etc.
It has all the Swagger docs required a file. Once you will deploy you need to change URL of swagger.
You also need to update Swagger.json file to your Server url path