Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules010209 authored Jan 29, 2023
1 parent f03ea58 commit 8a02cbd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/airac.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"LFBD": {
"runways": {
"050": "05",
"230": "23",
"110": "11",
"290": "29"
},
"sid": {
"05": {
"CNA5Q": {
Expand Down
16 changes: 12 additions & 4 deletions src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,25 @@ const fbw_api = "https://api.flybywiresim.com";

@Injectable()
export class AppService {
async atis(icao: any, res: any, req: any) {
async atis(icao: string, res: any, req: any) {
// let metar_infos = await axios.get(`${fbw_api}/metar/${icao}?source=ms`).then(resp => resp.data);
return axios.get(`https://avwx.rest/api/metar/${icao}`, {
return axios.get(`https://avwx.rest/api/metar/${icao.toUpperCase()}`, {
headers: {
Authorization: `Bearer ${process.env.KEY}`
}
}).then((resp) => {
return res.send(JSON.parse(resp['data']));
let data = JSON.parse(resp['data']);
let airport_departures = airac[icao.toUpperCase()].sid;
let airport_arivals = airac[icao.toUpperCase()].star;

let airport_runways = airac[icao.toUpperCase()].runways;

let wind = data?.wind_direction.value;

return res.send(data);
});

// let result = metar_json.match("(?<icao>(?:^[a-zA-Z]..[a-zA-Z]))(?:_(?<wing>(?:$..)))?");
// let result = metar_json.match("(?<icao>(?:^[a-zA-Z]..[a-zA-Z]))(?:_(?<wind>(?:$..)))?");

// airac[icao].sid['05']
}
Expand Down

0 comments on commit 8a02cbd

Please sign in to comment.