Skip to content

Instantly share code, notes, and snippets.

@MauricioRobayo
Created November 13, 2021 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MauricioRobayo/0facd7c0b2a992ed2225692883e0e3ca to your computer and use it in GitHub Desktop.
Save MauricioRobayo/0facd7c0b2a992ed2225692883e0e3ca to your computer and use it in GitHub Desktop.
Use a service layer for your business logic.
In this layer there should not exists any form of 'SQL query', use the data access layer for that.
- Move your code away from the express.js router
- Don't pass the req or res object to the service layer
- Don't return anything related to the HTTP transport layer like a status code or headers from the service layer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment