Node.js project with Express, Sequelize, Jest and Postgres
January 19, 2022 · View on GitHub
by @jesielviana
Directory structure
src
├── app.js app entry point
├── /routes controller layer: api routes
├── /config config settings
├── /services service layer: business logic
├── /models data access layer: database models
test
├── /unit unit test suites
├── /integration test api routes
Installation and execution
- Clone of this repository:
git clone https://github.com/jesielviana/nodejs-express-sequelize.git; - Enter the nodejs-express-sequelize folder:
cd nodejs-express-sequelize; - Run yarn to install dependencies:
yarn; - Config database credentials inside
/src/config/database.js; - Create database, run
yarn sequelize db:create to create the database; - Run
yarn devto start the server.
API
- Sign-up:
http://localhost:3000/api/auth/signup - Login:
http://localhost:3000/api/auth/signin - Courses:
http://localhost:3000/api/courses - Users:
http://localhost:3000/api/users - Students:
http://localhost:3000/api/students
References
- https://leanpub.com/construindo-apis-testaveis-com-nodejs
- http://expressjs.com/pt-br/
- Introduction to Express, a practical tutorial
- Bulletproof node.js project architecture
- Node.js Architecture and 12 Best Practices for Node.js Development | Scout APM Blog
- Melhores Práticas em Node.js
- https://jestjs.io/pt-BR/
Repository link of a frontend example that integrates with this API: https://github.com/jesielviana/frontend-ifpi-curso-nodejs