Advertisement
Guest User

Untitled

a guest
Feb 16th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. const express = require('express');
  2. const http = require('http');
  3. const massive = require('massive');
  4.  
  5. const app = express();
  6.  
  7. massive({
  8. host: '127.0.0.1',
  9. port: 5432,
  10. database: 'pgguide',
  11. user: 'geo17',
  12. password: 'geo17'
  13. }).then(instance => {
  14. app.set('db', instance);
  15.  
  16. app.get('/users', (req, res) => {
  17. req.app.get('db').query("select email, details from users order by created_at desc;")
  18. .then(items => {
  19. res.json(items);
  20. });
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement