aviation-model
Version:
Public methods for querying the information from aviation-pg
32 lines (24 loc) • 602 B
JavaScript
;
var Sequelize = require("sequelize");
var sequelize = new Sequelize("aviation", "aviator", null, {
host: "localhost",
dialect: "postgres",
port: 5432,
pool: {
max: 5,
min: 0,
idle: 1 + 1000
},
logging: false
});
function getAirportData(searchString, callback) {
sequelize.query("SELECT * FROM airports WHERE name LIKE :name ",
{ replacements: { name: searchString }, type: sequelize.QueryTypes.SELECT }
).then(function(data) {
callback(data);
});
}
var valencia = "%alenci%";
getAirportData(valencia, function(data) {
console.log(data);
});