Link to frontend repo : https://github.com/heysujal/hack-to-hire-frontend
-
Open termianl and run
npm i -
create a
.env filewhich looks like thisPORT=3000 DB_CONNECT=<YOUR_MONGO_URI> EMAIL_USER=<YOUR_GMAIL_ID> EMAIL_APP_PASSWORD=<YOUR_GMAIL_ID_GOOGLE_APP_PASSWORD> TWILIO_ACCOUNT_SID=<TWILIO_ACCOUNT_SID> TWILIO_AUTH_TOKEN=<TWILIO_AUTH_TOKEN> TWILIO_PHONE_NUMBER=<YOUR_TWILIO_PHONE_NUMBER>For twilio credentials visit their console For EMAIL_APP_PASSWORD. Go to setting of your gmail accout and search for App Passwords in Security settings. Create a new app name and copy the password.
-
Run
npm run dev
Note: Helper APIs may come handly in development and can be used for extending the project with new features. They are not being used directly at the moment.
{
"flight_id": "6E 1007",
"airline": "Indigo",
"status": "Delayed",
"departure_gate": "K11",
"arrival_gate": "L12",
"scheduled_departure": "2024-08-03T22:00:00Z",
"scheduled_arrival": "2024-08-03T00:00:00Z",
"actual_departure": null,
"actual_arrival": null,
"from": "DEL",
"to": "BLR"
} {
"flight_id": "6E 1007",
"airline": "Indigo",
"status": "Delayed",
"departure_gate": "K11",
"arrival_gate": "L12",
"scheduled_departure": "2024-08-03T22:00:00.000Z",
"scheduled_arrival": "2024-08-03T00:00:00.000Z",
"actual_departure": null,
"actual_arrival": null,
"from": "DEL",
"to": "BLR",
"_id": "66a95f65a6f06e95f14c7e98",
"__v": 0
}
GET - /api/flights/search?from=<SOURCE_CODE>&to=<DEST_CODE>&date=<YYYY_MM_DD_FORMAT_DATE>&flight_id=<FLIGHT_ID>
Note: The space present after "6E" in above API is intentional
[
{
"_id": "66a7c576c7a76b3d4070390a",
"flight_id": "6E 1003",
"airline": "Indigo",
"status": "Cancelled",
"departure_gate": "E5",
"arrival_gate": "F6",
"scheduled_departure": "2024-08-03T13:00:00.000Z",
"scheduled_arrival": "2024-08-05T15:00:00.000Z",
"actual_departure": null,
"actual_arrival": null,
"from": "DEL",
"to": "BLR",
"__v": 0
}
]
Other helper APIs like getFlightById and getAllFlights are also present.
Saves all the subscribers of a particular flightId
{
"contactInfo": "[email protected]",
"notificationMethod" :"email"
}{
"flightId": "6E 1004",
"subscribers": [
{
"contactInfo": "[email protected]",
"notificationMethod": "email",
"_id": "66a96743a6f06e95f14c7ea3"
}
],
"_id": "66a96743a6f06e95f14c7ea2",
"__v": 0
}
Saves all the subscribers of a particular flightId
[
{
"contactInfo": "[email protected]",
"notificationMethod": "email",
"_id": "66a96743a6f06e95f14c7ea3"
}
]
{
"username": "example",
"password": "pass123"
}{
"message": "Admin registered successfully"
}
{
"username": "example",
"password": "pass123"
}{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY2YTk2YWRmYTZmMDZlOTVmMTRjN2ViMiIsInVzZXJuYW1lIjoiZXhhbXBsZSIsImlhdCI6MTcyMjM3OTA3MiwiZXhwIjoxNzIyMzgyNjcyfQ.EMnxnYJCdMgKApMavCXywpi4RxZkvfBD-aPF5QAPNc8",
"isVerified": true,
"message": "User Verified"
}
Forms the part of Admin UI so that he gets prefilled values in the update form
{
"_id": "66a7c576c7a76b3d4070390a",
"flight_id": "6E 1003",
"airline": "Indigo",
"status": "Cancelled",
"departure_gate": "E5",
"arrival_gate": "F6",
"scheduled_departure": "2024-08-03T13:00:00.000Z",
"scheduled_arrival": "2024-08-05T15:00:00.000Z",
"actual_departure": null,
"actual_arrival": null,
"from": "DEL",
"to": "BLR",
"__v": 0
}