-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
32 lines (24 loc) · 807 Bytes
/
server.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
31
32
const express = require("express");
const dotenv = require("dotenv");
dotenv.config({ path: "./config/config.env" });
const fileupload = require("express-fileupload");
const path = require("path");
const morgan = require("morgan");
const users = require("./routes/users");
const photo = require("./routes/photo");
const follow = require("./routes/follow");
const app = express();
app.use(express.json());
app.use(fileupload());
app.use(express.static(path.join(__dirname, "public")));
app.use(morgan("combined"));
app.use("/api/v1/users", users);
app.use("/api/v1/photo", photo);
app.use("/api/v1/follow", follow);
const PORT = process.env.PORT || 5700;
app.get("/", (req, res, next) => {
res.json({ success: true });
});
app.listen(PORT, () => {
console.log("App listening on port 5700!");
});