Advertisement
Guest User

Untitled

a guest
Feb 29th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //DB setup
  2. const pg = require('pg');
  3. const client = new pg.Client({
  4.   user: 'grocerygroove_owner',
  5.   password: 'oq9urqwe09r8yr89q432yr8huirhgjbvh',
  6.   database: 'grocerygroove',
  7.   host: 'localhost',
  8.   port: '5432'
  9. });
  10.  
  11. //Express setup
  12. const express = require('express');
  13. const app = express();
  14.  
  15.  
  16. //Routes
  17. app.post('/user', function(req, res){
  18.   client.connect();
  19.   client.query('SELECT create_user($1, $2)', [req.email, req.password], function(err){
  20.     if(err)
  21.       console.log(err);
  22.     res.send("Failed");
  23.   });  
  24. });
  25.  
  26. app.listen(8080);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement