Implement HTTP API for the Cinema Network Project.
Data entry required:
- Cinemas (city, cinema name);
- Halls with reference to the cinema (name of the cinema hall, number of seats);
- Movies (name, year, duration);
- Sessions with reference to the hall;
API has to support:
- GET list of cinemas;
- GET list of the cinema halls;
- GET movie list;
- GET list of sessions that are added on a specific day;
- at the cinema;
- in the hall;
It is possible to denormalized entities: Cinema and Hall and merge them into one Mongo collection. But if two cinema company rents the same halls then the relation between Cinema and Hall will be many-to-many. That's why we keep normalization, it gives us flexibility and opportunity to migration to PostgreSQL, easy to create resolves with GraphQL schema.
GET Requests
host/api/v1/cinema/list
host/api/v1/hall/list/{cinema_id}
host/api/v1/movie/list
host/api/v1/sessions/{day}/{month}/{year}/{cinema_id}
host/api/v1/sessions/{day}/{month}/{year}/{hall_id}
POST Requests
host/api/v1/cinema
host/api/v1/hall
- Docker
- Docker-compose
- node
Install dependence
cd /service/api-server
mpm i
To start the project run in the root directory:
docker-compose up
To set up env params create file .env file in the root directory, see .env.config.
docker-compose is used during development and may run and connect several services. For deployment individual Docker file will be used for each service.
To seed, the database, invoke the route.
host/api/v1/seed
The database will be cleaned and populated with predefined data. To get the list of cinemas use route
host/api/v1/cinema/list