What is the recommended project structure for an Express API?
Model answer
Separate concerns: routes (URL mapping), controllers (request handling), services (business logic), models (database schemas), middleware, and config. Keep app creation separate from server start so tests can import the app. The exact folders matter less than keeping responsibilities clear.
Learn this topic
Express Middleware Explained: next(), Logging and express.json() in the course Node.js and Express: Build a Back End API from Scratch.
Sign in to add your own answer.