so I am working on the backend of my web app. I keep getting this error: password authentication failed for user "postgre"
const express = require("express")
const router = express.Router()
const Pool = require('pg').Pool
const pool = new Pool({
user: 'postgre',
host: 'localhost',
database: 'p2p',
password: 'hello',
port: 5432,
})
router.get('/',(req,res)=>{
res.render('physician/login')
})
//table: doc_reg,
router.post('/loggedin',(req,res)=>{
const {user_name,pw_1}=req.body
pool.query('INSERT INTO doc_reg (username,pw) VALUES ($1,$2)',[user_name,pw_1],(err, results)=>{
if (err){
console.log(err)
}
res.render('physician/loggedin',{username:user_name})
})
})
module.exports=router
Anything went wrong here?
Generally, this error occurs when you are using the wrong password for the given user.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.