From 958ffb3695e65384e0f1129c09bb880c012356f3 Mon Sep 17 00:00:00 2001 From: abhishekkjainn Date: Wed, 4 Dec 2024 05:14:28 +0530 Subject: [PATCH] Added the Documentation file for this index.html --- index.js | 345 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 344 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 6cd2bd4..c359059 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,350 @@ const cors = require('cors'); app.use(cors()); app.get('/', (req, res) => { - res.send('Documentation Incoming for Aerokey'); + res.send(` + + + + + + Airport API Documentation + + + +

Airport API Documentation

+

Welcome to the official documentation for the Airport API! This API provides detailed information on airports and airlines in India, such as airport codes, locations, types, and airlines operating in India.

+

Base URL: https://aerokey.vercel.app

+

Author: Abhishek Jain

+ +

API Endpoints

+ +
+
1. Get all Airports
+

Request:

+
GET /v1/airports
+

Response:

+
+{
+  "total": 1000,
+  "airports": [...],
+  "message": "Success",
+  "status": 200
+}
+    
+

This endpoint retrieves a list of all airports.

+
+ +
+
2. Get Airport by Code
+

Request:

+
GET /v1/airports/code/:code
+

Response:

+
+{
+  "airport_code": "DEL",
+  "airport_name": "Indira Gandhi International Airport",
+  "city_name": "New Delhi",
+  "state_name": "Delhi",
+  "airport_type": "International",
+  "pincode": "110037",
+  "state_code": "DL",
+  "message": "Success",
+  "status": 200
+}
+    
+

Error Message (if not found):

+
+{
+  "message": "Airport not found",
+  "status": 404
+}
+    
+

This endpoint allows you to retrieve information for a specific airport by its airport code.

+
+ +
+
3. Get Airport by Name
+

Request:

+
GET /v1/airports/name/:name
+

Response:

+
+{
+  "airport_code": "DEL",
+  "airport_name": "Indira Gandhi International Airport",
+  "city_name": "New Delhi",
+  "state_name": "Delhi",
+  "airport_type": "International",
+  "pincode": "110037",
+  "state_code": "DL",
+  "message": "Success",
+  "status": 200
+}
+    
+

Error Message (if not found):

+
+{
+  "message": "Airport not found",
+  "status": 404
+}
+    
+

This endpoint allows you to retrieve information for a specific airport by its name.

+
+ +
+
4. Get Airport by City
+

Request:

+
GET /v1/airports/city/:city
+

Response:

+
+{
+  "airport_code": "DEL",
+  "airport_name": "Indira Gandhi International Airport",
+  "city_name": "New Delhi",
+  "state_name": "Delhi",
+  "airport_type": "International",
+  "pincode": "110037",
+  "state_code": "DL",
+  "message": "Success",
+  "status": 200
+}
+    
+

Error Message (if not found):

+
+{
+  "message": "Airport not found",
+  "status": 404
+}
+    
+

This endpoint allows you to retrieve information for a specific airport by its city.

+
+ +
+
5. Get Airports by State
+

Request:

+
GET /v1/airports/state/:state
+

Response:

+
+[
+  {
+    "airport_code": "BOM",
+    "airport_name": "Chhatrapati Shivaji Maharaj International Airport",
+    "city_name": "Mumbai",
+    "state_name": "Maharashtra",
+    "airport_type": "International",
+    "pincode": "400099",
+    "state_code": "MH",
+    "message": "Success",
+    "status": 200
+  },
+  ...
+]
+    
+

Error Message (if no airports found):

+
+{
+  "message": "No airports found in this state",
+  "status": 404
+}
+    
+

This endpoint allows you to retrieve airports in a specific state.

+
+ +
+
6. Get Airport by Pincode
+

Request:

+
GET /v1/airports/pincode/:pincode
+

Response:

+
+{
+  "airport_code": "BLR",
+  "airport_name": "Kempegowda International Airport",
+  "city_name": "Bengaluru",
+  "state_name": "Karnataka",
+  "airport_type": "International",
+  "pincode": "560300",
+  "state_code": "KA",
+  "message": "Success",
+  "status": 200
+}
+    
+

Error Message (if not found):

+
+{
+  "message": "Airport not found",
+  "status": 404
+}
+    
+

This endpoint allows you to retrieve information for a specific airport by its pincode.

+
+ +
+
7. Get Airports by State Code
+

Request:

+
GET /v1/airports/statecode/:statecode
+

Response:

+
+[
+  {
+    "airport_code": "DEL",
+    "airport_name": "Indira Gandhi International Airport",
+    "city_name": "New Delhi",
+    "state_name": "Delhi",
+    "airport_type": "International",
+    "pincode": "110037",
+    "state_code": "DL",
+    "message": "Success",
+    "status": 200
+  },
+  ...
+]
+    
+

Error Message (if no airports found):

+
+{
+  "message": "No airports found for this state code",
+  "status": 404
+}
+    
+

This endpoint allows you to retrieve airports in a specific state code.

+
+ +
+
8. Get Airports by Type
+

Request:

+
GET /v1/airports/airporttype/:airporttype
+

Response:

+
+[
+  {
+    "airport_code": "DEL",
+    "airport_name": "Indira Gandhi International Airport",
+    "city_name": "New Delhi",
+    "state_name": "Delhi",
+    "airport_type": "International",
+    "pincode": "110037",
+    "state_code": "DL",
+    "message": "Success",
+    "status": 200
+  },
+  ...
+]
+    
+

Error Message (if no airports found):

+
+{
+  "message": "No airports found",
+  "status": 404
+}
+    
+

This endpoint allows you to retrieve airports based on their type (e.g., International, Domestic).

+
+ +

Airline Endpoints

+ +
+
1. Get all Airlines
+

Request:

+
GET /v1/airlines
+

Response:

+
+{
+  "airlines": [...]
+}
+    
+

This endpoint retrieves a list of all airlines.

+
+ +
+
2. Get Airline by IATA Code
+

Request:

+
GET /v1/airlines/code/:iata
+

Response:

+
+{
+  "iata_code": "AI",
+  "airline_name": "Air India",
+  "message": "Success",
+  "status": 200
+}
+    
+

Error Message (if not found):

+
+{
+  "message": "Airline not found",
+  "status": 404
+}
+    
+

This endpoint allows you to retrieve an airline's information by its IATA code.

+
+ +
+
3. Get Airline by Name
+

Request:

+
GET /v1/airlines/name/:name
+

Response:

+
+{
+  "iata_code": "AI",
+  "airline_name": "Air India",
+  "message": "Success",
+  "status": 200
+}
+    
+

Error Message (if not found):

+
+{
+  "message": "Airline not found",
+  "status": 404
+}
+    
+

This endpoint allows you to retrieve an airline's information by its name.

+
+ + + + + + `); }); app.get('/v1/airports', (req, res) => {