Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/haiderabb/node-express-flight-api
This project features a RESTful API built with Node.js and Express, leveraging MongoDB for database management to fetch flight information through multiple endpoints. Mongoose is employed for efficient database interaction and schema definition.
https://github.com/haiderabb/node-express-flight-api
api expressjs javascript mongodb mongoosejs nodejs postman restful-api
Last synced: about 1 month ago
JSON representation
This project features a RESTful API built with Node.js and Express, leveraging MongoDB for database management to fetch flight information through multiple endpoints. Mongoose is employed for efficient database interaction and schema definition.
- Host: GitHub
- URL: https://github.com/haiderabb/node-express-flight-api
- Owner: HaiderABB
- License: mit
- Created: 2024-07-04T12:35:55.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-25T13:12:01.000Z (4 months ago)
- Last Synced: 2024-10-11T12:03:21.668Z (about 1 month ago)
- Topics: api, expressjs, javascript, mongodb, mongoosejs, nodejs, postman, restful-api
- Language: JavaScript
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flight Information API
## Overview
This API provides endpoints to retrieve flight information based on various parameters such as origin, destination, travel dates, number of passengers, and class preference (economy, business, or first class).
## Endpoints
### Get Flights
#### Endpoint
#### Query Parameters
- **from**: Departure location.
- **to**: Destination location.
- **oneWay**: Boolean indicating if it's a one-way flight (`true` or `false`).
- **departureDate**: Date of departure (format: YYYY-MM-DD).
- **returnDate**: Date of return flight (required if `oneWay` is `false`; format: YYYY-MM-DD).
- **passengers**: Number of passengers.
- **class**: Travel class preference (e.g., economy, business, first).#### Example Usage
```bash
curl -X GET 'http://localhost:5000/api/flights?from=New+York&to=Los+Angeles&oneWay=false&departureDate=2024-07-10&returnDate=2024-07-15&passengers=2&class=economy'
```
## SetupTo set up and run the API locally, follow these steps :
1. Clone the Repository
```bash
git clone https://github.com/your-username/flight-info-api.git
cd flight-info-api
```2. Install Dependencies
```bash
npm install
```3. Run the Server
```bash
npm start
```