Skip to content

Commit

Permalink
Create dev compose file and add nodemon to restart the server
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGrabitzky committed Jul 28, 2023
1 parent e8385a2 commit 18e0d92
Show file tree
Hide file tree
Showing 6 changed files with 547 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Server/.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
POSTGRES_USER=root
POSTGRES_PWD=root
POSTGRES_DB=railtrail
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PWD}@localhost:5432/${POSTGRES_DB}

# [Server]
SERVER_PORT_EXT=8080
SERVER_PORT_INT=8080
SERVER_PORT=8080

ACCESSTOKEN=secret
4 changes: 2 additions & 2 deletions Server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
POSTGRES_USER=root
POSTGRES_PWD=root
POSTGRES_DB=railtrail
DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PWD}@postgres:5432/${POSTGRES_DB}?schema=public

# [Server]
SERVER_PORT_EXT=8080
SERVER_PORT_INT=8080
SERVER_PORT=8080
36 changes: 36 additions & 0 deletions Server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Railtrail Backend

## Devlopment setup

### Docker

First fire up the `docker-compose-dev.yml` to get the database running on your system:

```bash
docker-compose -f docker-compose-dev.yml up -d
```

### Express.js

To start developing the express.js backend use the following commands:

```bash
npm install
npm run dev
```

This will start the application and automatically restarts it on file change.

### Prisma

To generate the prisma client and push the changes to the database use this command:

```bash
npm run prisma
```

And if you want to inscept the database with the corresponding prisma schema use the follwing command to start prisma studio:

```bash
npx prisma studio
```
33 changes: 33 additions & 0 deletions Server/docker-compose-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3.8'

services:
postgres:
image: postgres:15-alpine
restart: unless-stopped
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PWD}
- POSTGRES_DB=${POSTGRES_DB}
ports:
- 5432:5432
volumes: # @Sascha: Je nachdem, ob du Bind-Mounts oder Docker-Managed Volumes bevorzugst, bitte hier ändern.
- railtrail-database:/var/lib/postgresql/data
networks:
- railtrail

#railtrail-website:
# image: ghcr.io/kieler/railtrail-website:development
# restart: unless-stopped
# ports: # @Sascha: Je nach Reverse-Proxy Situation hier bitte den Port anpassen:
# - "80:3000"
# environment:
# - PORT=3000
# - BACKEND_URI=https://railtrail.rtsys.informatik.uni-kiel.de:8080 # @Sascha: Je nach Reverse-Proxy Situation hier bitte die URI anpassen. Ohne Anführungsstriche o.ä.:
# networks:
# - railtrail

volumes:
railtrail-database:

networks:
railtrail:
Loading

0 comments on commit 18e0d92

Please sign in to comment.