Node.js with Postgres Example
- Node.js v8+ or Docker and Docker Compose
- Postgres running on local instance or Docker
- Install dependencies -
npm i
- Run project -
npm start
OR: Alternatives on pulling from Docker hub
docker run -d -p 5432:5432 --name postgres \
--env POSTGRES_PASSWORD=mysecretpassword \
--env POSTGRES_DB=heroes\
postgres
docker run -p 3000:3000 \
--link postgres:postgres \
-e POSTGRES_HOST=postgres:mysecretpassword@postgres:5432 \
-e POSTGRES_DB=heroes \
-e POSTGRES_SSL=false \
erickwendel/nodejs-with-postgres-api-example:latest
- Go to swagger page -
localhost:3000/documentation