How do I return a value from a promise (i probably didnt say that right)
eg. i need something like this
let is_connected;
test_connection(){
let is_connected;
promise().then(()=>is_connected = true).catch(()=> is_connected = false)
}
what I have now github:
const Sequelize = require('sequelize');
const db_config = {
blog: {
dialect: 'sqlite',
storage: 'src/database/blog.sqlite'
}
};
const blog_connection = new Sequelize(db_config.blog);
class DbController {
constructor(db_connection) {
this.db_connection = db_connection;
}
test_connection() {
this.db_connection
.authenticate()
.then(() => {
console.log('Successfully established connection');
})
.catch(() => {
console.log('Failed to establish connection');
});
}
}
const Blog = new DbController(blog_connection);
Blog.test_connection();