Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DB_HOST='localhost'
DB_NAME='bookmyshow'
DB_USER_NAME='panda'
DB_PASSWORD=''

JWT_SECRET='secret'
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# bookmyshow-api-nodejs-sql
This repository contains the code for a movie ticket booking API. The API allows users to select a theatre in the city and see the dates of the next 7 days. Users can then click on any date to see all the movies in that theatre on that given date. Movies are displayed with details of all the showtimes.

POSTMAN DOCS - [here](https://documenter.getpostman.com/view/7984450/2s93m5zgVx)

#### This is an API for booking movie tickets.

1. Get available movies for given - Cinema, Date
2. Check available seats for a show
3. Book tickets for a slot

![er-diagram](./readme-assets/er-diagram.png)

### Checklist

- [x] JWT Auth
- [x] Normalisation of database
- [x] Locking the DB while bulk operation with transactions
- [x] Indexing for better performance

### Example Query for the UI below

![example-query](./readme-assets/example-query.png)
![bookmyshow-ui](./readme-assets/bookmyshow.png)
26 changes: 26 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import dotenv from "dotenv";
dotenv.config({ path: ".env.example" });
import express from "express";
import routes from "./src/routes/index.js";

// Make all variables from our .env file available in our process

// Init express server
const app = express();

//rate limit

app.use(express.json());
app.use(express.urlencoded({ extended: true }));

// Here we define the api routes
app.use(routes);

const port = process.env.PORT || 8080;
const address = process.env.SERVER_ADDRESS || "localhost";

app.get("/", (req, res) => res.send("Hello World!"));

app.listen(port, () => console.log(`Server running on http://${address}:${port}`));

export default app;
Loading