Backend for Roommates written in Nodejs (Express)
- node@18.17.1
- prisma
- Clone and install dependencies
git clone git@github.com:sandeshkhadka/RooMates-backend.git
cd RooMates-backend
npm install
- Setup environment variables
cp .env.example .env
vim .env
- Start server
npm run dev
Make sure you have your database running before staring the server
Below is example how you can use docker with database within same network:
Set DATABASE_URL environment variable within .env file as below:
DATABASE_URL=postgresql://postgres:<POSTGRES_PASSWORD>@roommates:5432/roommates
*** You can skip setting up docker network postgresql container if you are using external databse***
sudo docker run -d \
--name roommates \
-e POSTGRES_PASSWORD=PASSWORD \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v ~/.docker/volumes/postgres:/var/lib/postgresql/data \
-p 5432:5432 --network roommates_network postgres
docker run -p 3000:3000 --network roommates_network --env-file ./.env sandeshkhadka/roommates-backend:latest