Next.js Discord

Discord Forum

sequelize auto create table

Unanswered
Huyenlong posted this in #help-forum
Open in Discord
Hi
I try to auto create table with sequelize.
First i configure db like this in a file :
const sequelize = new Sequelize({
  database: ENV.DATABASE,
  host: ENV.HOST,
  user: ENV.USER,
  password: ENV.PASS,
  dialect: PostgresDialect,
  models: [Model1, Model2],
});
export default sequelize;


Then i import in index of the server and run like this :
sequelize.sync().then(() => {
  app.listen(PORT, () => {
    console.log(`Server is running at http://localhost:${PORT}`);
  });
});


Before, app was express, now that s next.

The problem i do not know where is the index of the next.

Some body can help me

Thanks, and sorry to my English

0 Replies