improve probe route for todo-backend

This commit is contained in:
Guy Bianco IV 2021-06-24 14:06:34 -04:00
parent 31b4f274a7
commit bd4fc626ab

View file

@ -18,18 +18,18 @@ app.use(express.urlencoded({ extended: true }));
app.use(cookieParser()); app.use(cookieParser());
const sequelize = new Sequelize(dbConnectionOptions); const sequelize = new Sequelize(dbConnectionOptions);
sequelize
.authenticate()
.then(() => {
console.log("Connection has been established successfully.");
})
.catch((err) => {
console.error("Unable to connect to the database:", err);
});
app.get("/", (req, res) => { app.get("/", (req, res) => {
sequelize
.authenticate()
.catch((err) => {
console.error("Unable to connect to the database:", err);
res.status(500).send("Unable to connect to the database:" + err);
})
.then(() => {
res.send("OK"); res.send("OK");
}); });
});
// Add APIs // Add APIs
app.use("/api", BaseRouter); app.use("/api", BaseRouter);