# Server providing data for dashboard frontend

## Start server locally
Before you start the backend itself, go into the database directory and execute `docker-compose up -d`. On first startup of the app, data will be written to this database.

Run `npm install` to download all dependencies.

Run `npm start` to start the server locally. It will listen on port 8081.

Please note: The script 'start:prod' in the package.json is only for production environment. It will also build and serve the frontend.

## Endpoints
The endpoints of our api are defined in the folder `src/routes`. 

Please note: All query parameters 'from' and 'to' are considered unix timestamps. 

Endpoint to get all bike points: 
- `/api/bike-points/all`

Endpoint for landing page: 
- `/api/bike-trip-durations`
- query params: from, to, classSize (in seconds)

Endpoint for bike point details page: 
- `/api/bike-point-details/:bikePointId`
- query params: from, to, selectedDay (0=Monday to 6=Sunday)

Endpoint for map page: 
- `/api/bike-points-activity`
- query params: from, to