【问题标题】:Connection to PostgreSQL with node.js使用 node.js 连接到 PostgreSQL
【发布时间】:2014-04-20 07:23:12
【问题描述】:

我刚刚开始学习 node.js 以在我的网站上构建一个聊天应用程序。我正在尝试从 node.js 连接到 pgsql。我找到了如何通过以下方式连接到 mysql:

 var connection = mysql.createConnection({
 host     : 'localhost',
  user     : 'user',
  password : 'xxxxxx',
  database : 'rest',  
});
connection.connect(); 

有人可以帮我从 node.js 连接到 pgsql 吗?

【问题讨论】:

    标签: javascript node.js postgresql


    【解决方案1】:

    我相信通过 Google 搜索 PostgreSQL node.js 得到的最高结果可以胜任:https://github.com/brianc/node-postgres

    【讨论】:

    • 嘿,我尝试安装它。但得到一个错误,错误:SSL 错误:CERT_UNTRUSTED
    • 这与pg本身无关。您一定遇到了最近的突破性 npm 更新。检查blog.npmjs.org/post/78085451721/…
    • 让它工作..谢谢。您能帮我了解如何通过 node.js 设置基本的 ajax 轮询吗?
    • 恕我直言,你真的需要养成谷歌搜索的习惯。这将为您带来更快的回报,并为其他人节省大量时间。
    猜你喜欢
    • 2016-11-27
    • 2016-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-09
    • 2016-02-03
    • 1970-01-01
    相关资源
    最近更新 更多