node.js - node-postgres:数据库“database_name”不存在错误
问题描述
我正在使用PERN(postgres,express,react,node)构建REST API。我正在尝试在邮递员上测试我的用户注册路线,当我发送请求时出现此错误。“数据库 [我的数据库名称] 不存在”
我检查了 postgres 服务器,我可以清楚地看到我拥有数据库并创建了它。这是我的联系。
const Pool = require("pg").Pool
const pool = new Pool({
host: "localhost",
user: "[myuser]",
password: "[mypassword]",
port: 5432,
database: "rental"
})
module.exports = pool;
Name | Owner | Encoding | Collate | Ctype | Access privileges
----------------+----------------+----------+-------------+-------------+-----------------------
lucasleiberman | lucasleiberman | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
rental | lucasleiberman | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
rentalapp | lucasleiberman | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
解决方案
推荐阅读
- java - Android Retrofit2:创建片段时如何读取和设置 EditText 值?
- javascript - 在添加到列表之前搜索重复项
- algorithm - 从源到接收器的步行次数,恰好是 h 个跃点
- sql - 在 PostgreSQL 中使用 @extschema@ 是一个语法错误
- swift - Swift:闭包的执行顺序
- postgresql - 谜团:所有 postgres 数据库都消失了
- android - 逆向工程 BLE 设备 - 校验和?
- android - 单击外部时如何关闭Android对话框(使用FLAG_NOT_FOCUSABLE)
- java - 如何编译一个java项目来获取一个.jar文件
- postgresql - Postgres:忽略级联删除的 DELETE 触发器