Skip to content

db-s/book-theater-tickets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Book Theater Tickets

This is a demo application with a list of APIs to handle an imaginary theater ticket purchase. It also includes a couple APIs to show analytic data about theater visitors and earnings.

Get Started

Install Node Modules

Run the following command to install node modules

npm i

Run app directly

Start the server

npm start

Run tests

npm test

Access the app on http://localhost:3001

To check if API service is up, run the following command

curl http://localhost:3001/api/ping

Run app via Docker

Start Node.js and MongoDB services

docker compose up

Run tests on Docker container

docker container exec -it app_web /bin/bash -c 'npm run test:docker'

Authentication

  • For authentication, bearer token should be passed in request header Authorization. Here, you can just pass the string hello@123 and it will authenticate the APIs.
  • Base API path - /api, so to access any api, the url will look like this - http://localhost:3001/api/<API_ENDPOINT>

API Docs

Notes

  • For analytics data, start date and end data will actually look for Ticket model attribute performanceTime which indicates the time when play will be performed in the theater, not when the ticket was purchased.
  • App directory has been mounted into the container app_web using bind mount. So you can modify any file inside app directory and the change will reflect in docker container. However, it may take a few moments for the server to restart.

About

Theater Ticket Purchase & Analytics API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published