REST API directory structure

After consuming so many hours with developing apis in Nodejs, using apis and modifying existing apis I feel that there has to be a cleaner directory structure to help a new person in the team to understand the code straightaway.

Root directory:

|-app.js
|-config/
|-swagger.yml
|-controllers/
|-apiSchemas/
|-routes.js
|-businessLogic/
|-externalAPIs/
|-logger.js
|-tracer.js
|-middlewares/
|-test/
|-package.json
|-.env
|-readme

Individual directories:

config
|-app.js
|-constants.js
|-externalAPI1.js
|-externalAPI2.js

externalAPIs
|-externalAPIName1/
|-externalAPIName2/

externalAPIs/externalAPIName1
|-schema.js
|-errorMapper.js
|-contractMapper.js

controllers
|-operationId1.js
|-operationId2.js

Note : operation id is a field in swagger.yml that gets appended to req object if we use a swagger middleware

businessLogic
|-operationId1.js
|-operationId2.js

apiSchemas
|-operationId1.js
|-operationId2.js

Note: apiSchema validates the input request body.

middlewares
|-errorHandler.js

tests
|-unit
|-integration

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store