[英]Authentication error in connecting with postgres database
所以我正在我的 web 應用程序的后端工作。 我不斷收到此錯誤:用戶“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
這里有什么問題嗎?
通常,當您為給定用戶使用錯誤密碼時,會發生此錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.