Flight 7500 Sub Indo //top\\ (CERTIFIED 2027)
// ------------------------------------------------------------ // flight-status.js – Minimal example using AviationStack // ------------------------------------------------------------ require('dotenv').config(); const express = require('express'); const fetch = require('node-fetch');
| Step | Action | |------|--------| | 1 | Accept a flight number (e.g., 7500 ) and an optional origin/destination IATA code ( SUB , CGK , DPS , …). | | 2 | Query a public (or paid) flight‑tracking API (e.g., AviationStack, FlightAware, OpenSky, or any airline‑specific API). | | 3 | Normalise the raw response into a compact, developer‑friendly JSON that contains: • status (scheduled, active, landed, cancelled, diverted) • scheduled & actual departure/arrival times • gate & terminal info • aircraft type • current latitude/longitude (if airborne) • delay & baggage claim info | | 4 | Return the JSON (or an error object) to the caller. | | 5 | (Optional) Cache the result for ≈ 2 minutes to avoid hitting rate limits. | 2️⃣ API contract (REST‑style) GET /api/v1/flight-status?flight=7500&origin=SUB&destination=CGK | Parameter | Type | Required? | Description | |-----------|--------|-----------|-------------| | flight | string | Yes | Airline flight number without the airline code (e.g., 7500 ). | | origin | string | No | IATA code of the departure airport (e.g., SUB ). | | destination | string | No | IATA code of the arrival airport (e.g., CGK ). | | date | string (YYYY‑MM‑DD) | No | If you need a specific day’s schedule (default = today). | | apikey | string | Yes | Your key for the underlying flight‑data provider. | Successful response (HTTP 200) "request": "flight": "7500", "origin": "SUB", "destination": "CGK", "date": "2026-04-14" , "flight": "airline": "name": "Example Air", "iata": "EA", "icao": "EXA" , "flight_number": "7500", "aircraft": "model": "Airbus A320", "registration": "PH‑ABCD" , "schedule": "departure": "airport": "name": "Subic Bay International Airport", "iata": "SUB", "city": "Subic", "country": "PH" , "scheduled_time": "2026-04-14T08:30:00+08:00", "terminal": "1", "gate": "A12" , "arrival": "airport": "name": "Soekarno‑Hatta International Airport", "iata": "CGK", "city": "Jakarta", "country": "ID" , "scheduled_time": "2026-04-14T13:15:00+07:00", "terminal": "3", "gate": "B07" , "status": "code": "ACTIVE", // ACTIVE, LANDED, SCHEDULED, CANCELLED, DIVERTED "description": "En‑route", "delay_minutes": 12, "estimated_arrival": "2026-04-14T13:27:00+07:00" , "position": "latitude": -6.12345, "longitude": 106.56789, "altitude_feet": 28000, "speed_kts": 460, "heading_deg": 75, "last_update": "2026-04-14T09:45:12+08:00" , "baggage_claim": "carousel": "5", "available": true flight 7500 sub indo
app.get('/api/v1/flight-status', async (req, res) => const flight, origin, destination, date = req.query; if (!flight) return res.status(400).json( error: code: 'BAD_REQUEST', message: '`flight` is required' ); | | 5 | (Optional) Cache the result