blob: e512d28117e212955b12a858100c6c2e7a389caa (
plain)
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
|
import morgan from "morgan";
import express from "express";
import { config } from "dotenv";
import { resolve } from "path";
import { ratelimit } from "./config/ratelimit";
import errorHandler from "./config/errorHandler";
import notFoundHandler from "./config/notFoundHandler";
import animeRouter from "./routes";
config();
const app: express.Application = express();
const PORT: number = Number(process.env.PORT) || 4000;
app.use(morgan("dev"));
app.use(ratelimit);
app.use(express.static(resolve(__dirname, "..", "public")));
app.use("/anime", animeRouter);
app.use(notFoundHandler);
app.use(errorHandler);
app.listen(PORT, () => {
console.log(`⚔️ api @ http://localhost:${PORT}`);
});
|