-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
32 lines (24 loc) · 860 Bytes
/
index.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
import * as dotenv from "dotenv";
dotenv.config();
import express from "express";
import cors from "cors";
import bodyParser from "body-parser";
import errorHandle from "./middlewares/errorHandle.js";
import characterRoutes from "./routes/character/characterRoutes.js";
import miscRoutes from "./routes/misc/miscRoutes.js";
import weaponRoutes from "./routes/weapons/weaponRoutes.js";
const app = express();
const PORT = process.env.PORT || 5000;
app.use(cors());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.get("/", (req, res) => {
res.send("Welcome to genshin-api");
});
app.use(["/character", "/characters"], characterRoutes);
app.use(["/weapon", "/weapons"], weaponRoutes);
app.use("/others", miscRoutes);
app.use(errorHandle);
app.listen(PORT, () => {
console.log(`app running on port ${PORT}`);
});