From 7a55d2d965675b7fcd5053fd8487ac8814d8bfcb Mon Sep 17 00:00:00 2001 From: Sam Wilson Date: Sat, 16 Apr 2022 23:14:59 +1000 Subject: [PATCH] Restore ATC sectors API --- server.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server.js b/server.js index ccc9105..8ff14c3 100644 --- a/server.js +++ b/server.js @@ -93,6 +93,21 @@ app.get('/v1/flights/departures/:icaoCode', cors(), async (req, res) => { } }); +app.get('/v1/atc/sectors', cors(), async (req, res) => { + var standardOnly = (req.query.standardOnly == undefined ? false : req.query.standardOnly.toString()); + var sectors = await getATCSectors(); + if (standardOnly == "true"){ + sectors = sectors.filter(function(sector) { + return sector.standard_position===true; + }); + } + if(sectors == false){ + res.sendStatus(500); + }else{ + res.send(sectors) + } +}); + app.get('/v1/atc/online', cors(), async (req, res) => { var sectors = await getOnlinePositions(); if(sectors == false){