Guest User

Untitled

a guest
Mar 22nd, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. const client = new Client({
  2. user: 'ozan',
  3. host: 'localhost',
  4. database: 'blogpage',
  5. password: 'test',
  6. port: 5432,
  7. });
  8. client.connect();
  9.  
  10. client.query('SELECT * from persons', (err, res) => {
  11. console.log(err, res);
  12. client.end()
  13. });`
  14.  
  15. routes.post('/signup',(req, res)=> {
  16.  
  17.  
  18. const data = {username: req.body.usernamebody, email: req.body.emailbody, password: req.body.passwordbody};
  19.  
  20.  
  21. client.query('INSERT INTO persons(username,password,email) values($1, $2,$3)',
  22. [data.username, data.password, data.email]);
  23.  
  24.  
  25. });
Add Comment
Please, Sign In to add comment