refactor(homeRoute): replaced / route with static resources
This commit is contained in:
+10
-8
@@ -1,20 +1,22 @@
|
|||||||
import morgan from "morgan";
|
import morgan from "morgan";
|
||||||
import env from "./config/env";
|
import express from "express";
|
||||||
import express, { Application } from "express";
|
import { config } from "dotenv";
|
||||||
|
|
||||||
import animeRouter from "./routes";
|
import { resolve } from "path";
|
||||||
import { homePage } from "./controllers";
|
|
||||||
import { ratelimit } from "./config/ratelimit";
|
import { ratelimit } from "./config/ratelimit";
|
||||||
import errorHandler from "./config/errorHandler";
|
import errorHandler from "./config/errorHandler";
|
||||||
import notFoundHandler from "./config/notFoundHandler";
|
import notFoundHandler from "./config/notFoundHandler";
|
||||||
|
|
||||||
const app: Application = express();
|
import animeRouter from "./routes";
|
||||||
const PORT: number = env.PORT || 4000;
|
|
||||||
|
config();
|
||||||
|
const app: express.Application = express();
|
||||||
|
const PORT: number = Number(process.env.PORT) || 4000;
|
||||||
|
|
||||||
app.use(morgan("dev"));
|
app.use(morgan("dev"));
|
||||||
|
|
||||||
app.use(ratelimit);
|
app.use(ratelimit);
|
||||||
app.get("/", homePage);
|
|
||||||
|
app.use(express.static(resolve(__dirname, "..", "public")));
|
||||||
app.use("/anime", animeRouter);
|
app.use("/anime", animeRouter);
|
||||||
|
|
||||||
app.use(notFoundHandler);
|
app.use(notFoundHandler);
|
||||||
|
|||||||
Reference in New Issue
Block a user