JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q45499F
  • License MIT

Public methods for querying the information from aviation-pg

Package Exports

  • aviation-model

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (aviation-model) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Models

This package exposes public methods to retrieve information from the PostgreSQL database created at the aviation-pg module.

Configuration.

Include a file as a database.json with the details of your database connection, a database-sample.json is included, here is the sample:

{
  "host": "localhost",
  "dialect": "postgres",
  "port": 5432,
  "database": "aviation",
  "user": "aviator",
  "password": null
}

Usage

Install via npm with npm install aviation-model

If you haven't created the database with the aviation-pg, the following won't work.

Methods available.

Next you have a quick example.

Include the module at your code:

var aviationModel = require("aviation-model");

Then use as explained in detail at the docs the different methods, a quick example:

aviationModel.getAirportJson({
  airport_id: "San_Francisco_International_Airport"
}, function (err, airport) {
  if (err) {
    throw err;
  }
  console.log("Airport: ",airport);
});

// This will print out:
Airport:  { location: '37°37′08″N 122°22′30″W',
  airport_id: 'San_Francisco_International_Airport',
  latitude: '37°37′08″N',
  longitude: '122°22′30″W',
  name: 'San Francisco International Airport',
  nickname: 'SFO',
  iata: 'SFO',
  icao: 'KSFO' }

Testing

Run the command make test, this will check with ESLint the code and run the tests, if the database.json file is not located, it will return an error.

The default make command will do the npm install, update the database formulas with the one needed and will run the tests.

Contributions:

If you want to contribute, create your branch and place a PR or open an issue.