-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
30 lines (26 loc) · 809 Bytes
/
app.js
File metadata and controls
30 lines (26 loc) · 809 Bytes
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
const express = require("express");
const cors = require ('cors');
const mysql = require("mysql2");
const bodyParser = require("body-parser");
const PORT = process.env.PORT || 3050;
const mysqlConnection = require("./mysql/config");
const app = express();
app.use(cors());
app.use(bodyParser.json());
app.use("/benefit", require("./routes/benefits/routes"));
app.use("/customer", require("./routes/customers/routes"));
app.use("/plan", require("./routes/plan/routes"));
app.use("/pet", require("./routes/pets/routes"));
app.use(cors(
{ origin: "https://backsafepet.herokuapp.com" }
)
);
mysqlConnection.connect((error) => {
if (error) {
throw error;
}
console.log("Database server running");
});
const server = app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});