This is a RESTAPI made for Flight Booking Web Application
Admin can create a flight by providing the following ->
Origin
Destination
Flight name
Seat Configuration for each class
Seat Configuration for a particular class->
Seats in a row
Number of rows
Base Price
When the admin creates a flight then he/she has to provide the seat configuration for each and every class
Classes ->
First Class
Business Class
Economy Class
After that every seat in each class will be populated with a seat number and a unique system generated PNR which is a 8 digit alpha - numeric code
1st digit of the PNR -> shows the class
F -> First Class
B -> Business Class
E -> Economy Class
2nd digit of the PNR -> shows the seat number in each class
F1 -> Seat number 1 in First Class
B2 -> Seat number 2 in Business Class
E3 -> Seat nunber 3 in Economy Class
Remaining digits -> randomly generated
User can select the origin and the destination
After he selects the origin and the destiantion all the flights available for that route will be displayed to the user
After that user needs to select a particular flight and provide the class in which he/she wants the ticket in.
After that according to the selection entire seat map for that particular flight and class will be displayed to the user
Now user can select any seat by providing seat number and PNR
Ticket for that particular user will be generated
Javascript
Node.js
Express.js
MongoDB
Mongoose
Implementation of Middlewares
Implementation of Controllers
Implementation of Error Handlers
Implementation of Async Handlers
User Authentication and Authorization
Admin Authentication and Authorization
CRUD operations
Password Hashing
JWT Token Generation
JWT Token Verification
Implementation of Public Routes
Implementation of Protected Routes
Relationship Handling in MongoDB
npm i nodemon
npm i express
npm i mongoose
npm i express-async-handler
npm i bcrypt
npm i jsonwebtoken
npm i dotenv
npm i cors
npm run dev
PORT
CONNECTION_STRING -> for connecting to our Database
ACCESS_TOKEN_SECRET_USER
ACCESS_TOKEN_SECRET_ADMIN
CRUD Operation | HTTP Method | API Endpoint | Type |
---|---|---|---|
Sign Up | POST | /admins/signup | public |
Login | POST | /admins/login | public |
Post a flight | POST | /admins/post | private |
CRUD Operation | HTTP Method | API Endpoint | Type |
---|---|---|---|
Sign Up | POST | /users/signup | public |
Login | POST | /users/login | public |
Select source and destination | POST | /users/selectSD | private |
Select a flight | POST | /users/selectFlight | private |
Select a seat | POST | /users/selectSeat | private |
API testing is done by Thunder Client and Postman is used for publishing the API DOCS provided in the description.