mirror of
https://github.com/Floriansylvain/space-game-api.git
synced 2026-08-19 11:43:19 +02:00
d3109983fee439206f0834c13d5468a608a1ba5f
what-to-do-in-paris-backend
Project setup
Environment variables
The following environment variables are required to run the project:
| Variable name | Description |
|---|---|
PORT |
Port on which the server will run |
POSTGRES_PASSWORD |
Password for the root user of the PostgreSQL database |
DATABASE_URL |
URL of the PostgreSQL database, for Prisma. Required when not using Docker |
JWT_SECRET |
Secret used to sign the JWT tokens |
You can either export them in your shell, or create a .env file at the root of the project.
Install dependencies
pnpm install
Run the server
With Docker
docker compose up --build -d
Without Docker
pnpm run build
pnpm run start
Routes
| Method | Route | Description | Body |
|---|---|---|---|
POST |
/v1/auth/register |
Register a new user | email, password, name |
POST |
/v1/auth/login |
Login a user | email, password |
POST |
/v1/events |
Create new events | Array<Event> (see data.json in /script) |
GET |
/v1/events?limit=&page=&from=&to=&deaf=&pmr=&blind=&sortBy=&sortOrder= |
Get all events | limit: number, page: number, from: timestamp, to timestamp, tags: strings separated by ,, pmr: 0 or 1, deaf: 0 or 1, blind: 0 or 1, sortOrder: asc or desc, sortBy: field of Event |
GET |
/v1/events/:id |
Get an event by its id |
Other information
A default admin user is created when the server starts for the first time. Its password is displayed in the logs of the backend.
Languages
TypeScript
83.2%
Dockerfile
13.5%
JavaScript
3.3%