-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
30 lines (26 loc) · 831 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const express = require("express");
const bodyParser = require("body-parser");
const { Sequelize } = require("sequelize");
const router = require("./routes");
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use("/api/v1", router);
const sequelize = new Sequelize("wander_wisely", "root", "wander3306wisely", {
// dialectOptions: {
// socketPath: "/var/run/mysqld/mysqld.sock",
// },
host: "34.101.227.234",
port: "3306",
dialect: "mysql",
});
// listening port
app.listen(8080, async () => {
try {
await sequelize.authenticate();
console.log("Connection has been established successfully.");
console.log("server running on http://localhost:8080");
} catch (error) {
console.error("Unable to connect to the database:", error);
}
});