Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

558
Views
(node:4691) UnhandledPromiseRejectionWarning: SequelizeConnectionError: Connection terminated unexpectedly

Thank you for taking a look at this

I created a database called wikistack, then try to connect it with sequelize , but this error,"SequelizeConnectionError: Connection terminated unexpectedly"

Inside app.js

const express = require('express');
const morgan = require('morgan');
const path = require('path');
const layout = require('./views/layout');
const { db } = require('./models');

const app = express();

app.use(morgan('dev'));
app.use(express.static(path.join(__dirname, 'public')));


db.authenticate()`enter code here`
  .then(() => {
    console.log('connected to the database');
  })

app.get('/',(req,res) =>{
    res.send(layout(""));
});

app.listen(1337,function(){
    console.log("You can do it!")
})

inside /models/index.js

const Sequelize = require('sequelize');
const db = new Sequelize('postgres://localhost:1337/wikistack');

module.exports = {
  db
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!