Answer the question
In order to leave comments, you need to log in
REST API backend file structure?
Hello!
I'm working on backend on Expressjs. The customer asks that the backend should consist of two APIs:
shop-api.routes.js: /api/shops/bla-bla
buyer-api.routes.js: /api/buyers/bla-bla
There are a lot of routes between the shops and buyers routes general functionality.
Please help with file structure. I see these options:
1) as few files as possible
src
..api
....shop-api.js <- весь функционал shop-api
....buyer-api.js <- весь функционал buyer-api
..helpers
....api-common.js <- общий функционал (между shop и buyer)
src
..api
....shop-api
......shop-api.users.js <- функционал сгруппирован по сущностям
......shop-api.books.js
....buyer-api
......buyer-api.users.js
......buyer-api.books.js
..helpers
....api-common.js <- общий функционал
src
..api
....shop-api
......users
........shop-api.users.get.js <- 1 роут - 1 файл
........shop-api.users.post.js
....buyer-api
......users
........shop-api.users.get.js
........shop-api.users.post.js
..helpers
....api-common.js <- общий функционал
..helpers
....api-common.users.js <- общий функционал разбит на модули
....api-common.books.js
Answer the question
In order to leave comments, you need to log in
How would it be done like this: https://docs.nestjs.com/modules
https://www.yiiframework.com/doc/guide/2.0/en/stru...
https://symfony.com/doc/ 4.1/bundles/best_practices.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question