1.0.5 • Published 2 years ago

@chatpta/starter-api-express v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Express starter api application serves JSON

Create express api application

npx @chatpta/starter-api-express my-api

To run application in docker compose,

Express runs at localhost:3000 and postgres runs at localhost:5432

docker-compose -f docker-compose.yaml up

Start postgres database in container, available at host port 5432

docker-compose up db-starter-api-express

Test connection to db

psql "postgresql://user:password@localhost/chatpta_db"

Run application

 npm install
 npm run devstart

Run test in watch mode with postgres db connection

 npm run test

Run test in watch mode WITHOUT postgres db connection

 npm run testWithoutDb

Run the build script to do all of above

 ./build

Run database migration to create database tables

 npm run migrateDb