sjy-ecos/model/ei.js

21 lines
514 B
JavaScript
Raw Normal View History

2016-12-23 10:16:12 +00:00
var pg = require('pg');
exports.fetchAll = function (req, res, callback) {
var table_name = 'sjy_' + req.url.replace('/', '');
pg.connect(Connections.pg_sjy_gis, function (err, client, done) {
if (err) {
return console.error('error fetching client from pool', err);
}
client.query('SELECT * FROM ' + table_name, function (err, result) {
done();
if (err) {
return console.error('error running query', err);
}
res.send(result)
});
});
};
exports.getOne = function (id, callback) {};