AuthorizationServerDemos/Node/Property/queries.js
Muhammad Azeez f78d6b3d73 node api
2021-01-12 13:06:29 +03:00

21 lines
438 B
JavaScript

const Pool = require('pg').Pool
const pool = new Pool({
user: 'postgres',
host: 'localhost',
database: 'real_estate',
password: 'root',
port: 5432,
});
const getAllRealEstate = (request, response) => {
pool.query('SELECT * FROM real_estate ORDER BY id ASC', (error, results) => {
if (error) {
throw error
}
response.status(200).json(results.rows)
})
};
module.exports = {
getAllRealEstate
}