An open API service indexing awesome lists of open source software.

https://github.com/xredax/flights-api


https://github.com/xredax/flights-api

Last synced: 27 days ago
JSON representation

Awesome Lists containing this project

README

        

Flight API - Find Cheap Flights in Morocco


This is a web scraper built with Node.js and Puppeteer to retrieve the cheap flights information.

Installation


Before running the application, make sure you have Node.js and npm installed on your machine.

Clone the repository


git clone https://github.com/XredaX/flights-api.git

Navigate to the project directory


cd flights-api

Install dependencies


npm install

Usage


Before starting the server, if you want to see the backend working, set headless to false:


headless: false

If not, leave it as true:


headless: true

To start the server, run the following command:


npm run start

Once the server is running, you can access the API endpoint to retrieve flight information.


API Endpoint


GET /flights


Query Parameters:




  • from: Departure city name


  • to: Arrival city name


  • date: Departure date in yyyy-mm-dd format

Example Request:


http://localhost:4000/flights?from=Oujda&to=Rabat&date=2024-07-15

Make sure to change the configuration to match your setup

The Result:


Result Image

If you need any assistance with the code, feel free to contact me via email [email protected]


Or through LinkedIn Reda El Bettioui

If you appreciate the work, please consider giving it a star ⭐