Skip to content

pokers/backend_template

Repository files navigation

Notice Board

NodeJS backend template

Prerequisite

Belows should be installed on your system before running this code of server.

  • Node.js version 18.14.x or more latest version
  • npm version 9.5.x or more latest version
  • PostgresQL 14.6 (It can be downloaded as a docker image from general)
  • Docker latest version
  • Docker-compose latest version (for development)

Installing

Package installing

npm install --save

Engineering Guide

Preparing Environment

There are all default values in the env files already

  1. Backend environment
    • open ./env/backend.env file and update your desired values.
  2. DB environment
    • open ./env/backend.env file and update your loca values.


Preparing local DB

It's for local developing. The Production DB will be running standalone, please do not connect while you are developing

  • Start DB

    docker-compose -f ./docker/DB-docker-compose.yml --env-file ./deploy/env/postgresql.env up -d
  • Stop and clean up DB

    docker-compose -f ./docker/DB-docker-compose.yml --env-file ./deploy/env/postgresql.env down

  • DB Migration
    • install migration tool
      npm install knex -g
    • Run migration
      knex migrate:latest

Test Commands

Unit test

  • Full test
    npm run test
  • Module test
    npm run test:{folder name}
    • ex> npm run test:dao, npm run test:dao:repositories, npm run test:services


Running Service Commands

run local environment

npm run start:local

run dev environment

npm run start:dev

run production environment

npm run start:prod

Usefull Utilitis

pgcli postgresql Command line Client

  • Install (for Mac)
    brew install pgcli
  • Usage
    • connect
      pgcli -h {HOST} -p {PORT} -u {user}
      ex> $pgcli -h 127.0.0.1 -p 5432 -u book

Postgresql GUI Client

About

NodeJS backend template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published