-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
26 lines (22 loc) · 796 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
const express = require("express");
const jwt = require("jsonwebtoken");
const port = 3000;
const bodyParser = require("./middlewares/bodyParser");
const authController = require("./controllers/authController");
const userRoutes = require("./routes/users");
const postRoutes = require("./routes/posts");
const likeRoutes = require("./routes/likes");
const commentRoutes = require("./routes/comments");
const app = express();
// Middleware
app.use(bodyParser);
// Routes
app.post("/api/login", authController.login);
app.post("/api/register", authController.register);
app.use("/api/users", userRoutes);
app.use("/api/posts", postRoutes);
app.use("/api/likes", likeRoutes);
app.use("/api/comments", commentRoutes);
app.listen(port, () => {
console.log(`Server running on port ${port}`);
});