Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. // DATABASE
  2. const mysql = require("mysql");
  3.  
  4. var config = {
  5. host: "localhost",
  6. port: 3306,
  7. database: "minesweeper",
  8. user: "root",
  9. password: "",
  10. };
  11.  
  12. const Q = {
  13. SELECT_PASSWORD_FOR_USERNAME :"SELECT password from login where username = ?",
  14. };
  15.  
  16. var connection = mysql.createConnection(config);
  17. connection.connect();
  18.  
  19.  
  20.  
  21.  
  22. app.post("/doLogin",(req,res) => {
  23. // res.send("You sent the name " + req.body.username + ".");
  24. connection.query(Q.SELECT_PASSWORD_FOR_USERNAME, req.body.username ,function(err, result) {
  25. if(result.)
  26. if (err) return console.log(err);
  27. else{
  28. res.sendFile(__dirname+"/public/index.html");
  29. console.log("hallo")
  30. }
  31. });
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement