-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
31 lines (26 loc) · 844 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
const express = require("express");
const app = express();
const bodyParser = require("body-parser");
const morgan = require("morgan");
const helmet = require("helmet");
const cors = require("cors");
const PORT = 8080;
// express Configuration
app.use(cors());
app.use(helmet());
app.use(morgan("dev"));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(express.static("public"));
const topicsRoutes = require("./routes/topics");
const cardsRoutes = require("./routes/cards");
const userRoutes = require("./routes/user");
app.use("/api/topics", topicsRoutes);
app.use("/api/topics", cardsRoutes);
app.use("/api/user", userRoutes);
app.listen(PORT, () => {
// eslint-disable-next-line no-console
console.log(
`express seems to be listening on port ${PORT} so that's pretty good 👍`
);
});