Skip to content

Commit

Permalink
Added error handling for empty callsigns
Browse files Browse the repository at this point in the history
  • Loading branch information
Kahn committed Apr 16, 2022
1 parent 7a55d2d commit 1954d00
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
15 changes: 12 additions & 3 deletions APIS_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,23 @@ Route `/flights/`
#### Arivals

Route `/arrivals/<ICAO code>`
Returns `[pilot]`
Returns
- 200 `[pilot]`
- 404
- 500

#### Callsign

Route `/callsign/<callsign>`
Returns `{pilot}`
Returns
- 200 `{pilot}`
- 404
- 500

#### Departures

Route `/departures/<ICAO code>`
Returns `[pilot]`
Returns
- 200 `[pilot]`
- 404
- 500
2 changes: 1 addition & 1 deletion config/default.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"app": {
"name": "vatsim-map",
"version": "0.0.1",
"version": "0.0.3",
"url": "https://github.com/vatpac-technology/vatsim-map/",
"log_level": 30,
"http": {
Expand Down
2 changes: 1 addition & 1 deletion config/production.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"app": {
"name": "vatsim-map",
"version": "0.0.1",
"version": "0.0.3",
"url": "https://github.com/vatpac-technology/vatsim-map/",
"log_level": 30,
"http": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vatsim-map",
"type": "module",
"version": "0.0.1",
"version": "0.0.3",
"description": "Display VATSIM traffic on a map for a given set of FIRs",
"private": true,
"dependencies": {
Expand Down
2 changes: 2 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ app.get('/v1/flights/callsign/:callsign', cors(), async (req, res) => {
const feature = pilots.features.find(e => e.properties.pilot.callsign === req.params.callsign)
if(feature == false){
res.sendStatus(500);
} else if(feature == undefined){
res.sendStatus(404);
}else{
res.send(feature.properties.pilot)
}
Expand Down

0 comments on commit 1954d00

Please sign in to comment.