21 lines
514 B
JavaScript
21 lines
514 B
JavaScript
|
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) {};
|