-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
33 lines (29 loc) · 809 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
33
require("dotenv").config();
const express = require("express");
const cors = require("cors");
const app = express();
const port = 3001;
// ROUTES
const items = require("./routes/items");
const nodemailer = require("./routes/nodeMailer");
const leaderboard = require("./routes/leaderboard")
app.use(cors());
app.use(express.json({ limit: "25mb" }));
app.use(express.urlencoded({ limit: "25mb", extended: true }));
app.use((req, res, next) => {
res.setHeader("Access-Control-Allow-Origin", "*");
next();
});
app.get("/", async (req, res) => {
try {
res.json("Hello");
} catch (error) {
console.error(error);
}
});
app.use("/items", items);
app.use("/leaderboard", leaderboard)
app.use("/nodemailer", nodemailer);
app.listen(port, () => {
console.log(`server is running on ${port}`);
});