I am having issues with setting up the sequelize module for node.js.
First I set up a username and password in postgresql:
postgres=# CREATE USER testuser WITH PASSWORD 'test';
Here is my initialize code:
var Sequelize = require('sequelize');
var sequelize = new Sequelize('testdb', 'testuser', 'test', {
host: 'localhost',
port: 5342,
dialect: 'postgres'
});
sequelize.query('select * from mytbl').success(function(tbl){
console.log('success');
});
However, when i run this short bit of code I get the following error:
events.js:72
throw er; // Unhandled 'error' event
^
Error: Failed to authenticate for PostgresSQL. Please double check your settings.
I am not sure what I am doing wrong? If anyone can help it would be greatly appreciated. Thanks!
psql
using the same connection info, e.g.psql -h localhost -U testuser testdb
. – Milen A. Radev Dec 20 '13 at 13:18sequelize = new Sequelize('postgres://testuser:test@localhost:5432/testdb', { dialect: 'postgres', protocol: 'postgres' })
– MikeSmithDev Dec 20 '13 at 13:50