From 7eb3358f35dcb479a0fceecabe09069e3695c4d0 Mon Sep 17 00:00:00 2001 From: Md Sakibul Hasan Date: Fri, 12 Jul 2024 09:25:55 +0600 Subject: [PATCH] refactored code. --- src/routes/entry.ts | 9 --------- src/startup/routes.ts | 16 +++++++--------- 2 files changed, 7 insertions(+), 18 deletions(-) delete mode 100644 src/routes/entry.ts diff --git a/src/routes/entry.ts b/src/routes/entry.ts deleted file mode 100644 index 5a7fe3c..0000000 --- a/src/routes/entry.ts +++ /dev/null @@ -1,9 +0,0 @@ -import express, {Request, Response} from "express"; - -const router = express.Router(); - -router.get("/", (req: Request, res: Response) => { - res.send("Testing 8:10pm"); -}); - -export default router; \ No newline at end of file diff --git a/src/startup/routes.ts b/src/startup/routes.ts index db9946f..6c1827d 100644 --- a/src/startup/routes.ts +++ b/src/startup/routes.ts @@ -1,22 +1,20 @@ -import { NextHandleFunction } from "connect"; import express from "express"; -var cookieParser = require('cookie-parser') - import v2_languages from "../routes/v2_languages"; import v3_languages from "../routes/v3_languages"; import summarizer from "../routes/summarizer"; import v3_translate from "../routes/v3_translate"; -import entry from "../routes/entry"; import authRoutes from "../routes/authRoutes"; -import { requireAuth } from "../middleware/authMiddleware"; import { API_VERSION } from "../config"; module.exports = function (app: any) { - // @ts-ignore - app.use(express.json()) // for parsing application/json - app.use(express.urlencoded({extended: true})) // for parsing application/x-www-form-urlencoded - app.use(cookieParser()); + const middleware = [ + express.json(), + express.urlencoded({extended: true}), + require('cookie-parser')() + ] + + app.use(middleware); app.use(`/${API_VERSION}/languagesv2`, v2_languages); app.use(`/${API_VERSION}/languages`, v3_languages);