Simple test app.
npm install
node server.js
By default runs on port 3000.
You need to specify your mongodb database url as MONGO_URI and secret key for JWT as SECRET_KEY in a .env file.
npm test
To register a new user specify keys 'username' and 'password' in the request's body.
POST /api/register/
Then you can use the same credentials sending them the same keys to log in.
POST /api/login/
The REST API to the example app is described below. All POST, PUT and DELETE routes require user to be logged in.
GET /api/halls/
JSON containing list of all halls
POST /api/halls/
Value for key 'name' has to be specified in the request's body.
"Successfully created new hall: hall_name."
GET /api/hall/hall_id
JSON containing specified hall
PUT /api/hall/hall_id
Value for key 'name' has to be specified in the request's body.
"Successfully updated hall: hall_name."
DELETE /api/hall/hall_id
Deletes the hall only if there are no future or present screenings assigned to it.
Successfully deleted hall.
GET /api/screenings/hall_id
JSON containing list of all screenings for specified hall
POST /api/screenings/hall_id
Values for keys 'film', 'beginning' and 'end' have to be specified in the request's body.
Screenings for one hall can't overlap.
"Successfully created new screening: screening_film."
GET /api/screening/screening_id
JSON containing specified screening
PUT /api/screening/screening_id
Values for keys 'film', 'beginning' and 'end' have to be specified in the request's body.
To change screening's hall, value for key 'hall' has to be specified in the request's body.
Screenings for one hall can't overlap.
"Successfully updated screening: screening_name."
DELETE /api/screening/screening_id
Successfully deleted screening.
Needs local mongodb database. To run use:
npm test