Node.js starter template
- Docker engine
- docker-compose
- Node.js 16.x
- npm 8.x
# Clone repo
git clone [email protected]:dustinmwang2104/nodejs-starter.git
cd nodejs-starter
# Install npm dependencies
npm install
# Create and start docker containers
docker-compose up
# Run database migrations and seeders
docker-compose exec app npm run migrate:refresh:seed
docker-compose up
or docker-compose start
will start server on host's port
3333
and will expose main postgres server on host's port 4444
.
*Tip:
docker-compose
setup is only for development purpose.
# Start server
npm start
# Start server with hot-reloading
npm run dev
# Run unit tests
npm test
# Run unit tests with code coverage report
npm run test:coverage
# Lint source files
npm run lint
# Lint source files and fix
npm run lint:fix
# Run database migration
npm run migrate
# Create a new database migration
npm run migrate:make
# Refresh database and run migrations
npm run migrate:refresh
# Refresh database, run migrations and run seeding
npm run migrate:refresh:seed
# Rollback all database migrations
npm run unmigrate
# Run database seeding
npm run seed
# Create a new database seeder
npm run seed:make