forked from macnaer/REST-API-Express-f12
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
30 lines (20 loc) · 722 Bytes
/
app.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
const express = require("express");
const bodyParser = require("body-parser");
// import Routes
const RegistrationRouter = require("./routes/usersRouter");
// Import Database
const db = require("./data/config/database");
const { json } = require("body-parser");
db.authenticate()
.then(() => console.log("Database conected... "))
.catch(err => console.log("Connection error => ", err));
const PORT = 5000;
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use((req,res, next) => {
console.log("Request => ", new Date());
next();
});
app.use("/api/users", RegistrationRouter);
app.listen(PORT, () => console.log(`Server running on port ${PORT}`))