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