最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

与postgres数据库连接时发生验证错误

IT培训 admin 13浏览 0评论

与postgres数据库连接时发生验证错误

所以我正在开发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

这里出什么事了?

回答如下:

通常,当您使用给定用户的密码时出现此错误。

与postgres数据库连接时发生验证错误

所以我正在开发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

这里出什么事了?

回答如下:

通常,当您使用给定用户的密码时出现此错误。

发布评论

评论列表 (0)

  1. 暂无评论