A Standard Boilerplate for Node Express REST API
- Language :
- Pacakges :
- Database :
- Utility :
mv .env.manual .env
npm install
bash migrate.sh
npm run dev
npm run build
npm run prod
Note: If you run manual installation, make sure postgre and redis server is running or that will be error
// Build and running docker container
docker-compose build
docker-compose up
// Stop all running container
docker-compose down
- 5000:5000 Express Rest API
- 5400:5432 PostgreSQL
- 6379:6379 Redis
- 8080:8080 Adminer
npm run test
Note: If you run manual test, make sure postgre and redis server is running or that will be failed
docker exec express-api npm run test
Note: Make sure you have run docker production installation before run it
// Run it in Bash terminal
bash migrate.sh
Note: If you run manual migration, make sure postgre server is running or that will be error
docker exec express-api bash migrate.sh
Note: Make sure you have run docker production installation before run it
.
├── __test__ // Jest test file
├── database // Knex Module
├── dist // Automatically generate when you run production Installation
├── src
│ ├── controllers
│ │ └── **.ts
│ ├── helper
│ │ └── **.ts
│ ├── models
│ │ └── **.ts
│ ├── routes
│ │ └── **.ts
│ ├── app.ts // Main
│ └── index.ts // Running Sever
├── .env
├── docker-compose.yml
├── Dockerfile
├── jest.config.js // Jest Configuration
├── knexfile.ts // Knex Configuration
├── migrate.sh // Shell migrate Database
├── redis.ts // Redis Configuration
├── swagger.json // Swagger Definition
└── ...
After you running development/production Installation you can see documentation at : http://localhost:5000/docs