Reputation: 523
I have a database I generated through postgres. How do I connect it to sequelize for node.js?
I know the basic syntax for sequelize connections, but how do I connect these together?
Upvotes: 0
Views: 2459
Reputation: 276266
In node.js
after installing the sequelize
and pg
packages through npm
you can do this:
var sequelize = new Sequelize('your_database_name', 'user', 'password', {
host: "localhost", //your server
port: 12345 //server port
dialect: 'postgres'
});
Note, in order to use Sequelize with Postgres you'll_need the postgres package. The Sequelize homepage contains instructions on changes you might need to make in order to use them together.
Upvotes: 5