From ee76f4363329f9c7fb25234efd5c154aa7fb2f93 Mon Sep 17 00:00:00 2001 From: Adeosun Oluwaseyi Date: Sun, 28 Jul 2024 17:17:02 +0100 Subject: [PATCH 1/6] feat: Add /hng-test Page to Display Version and Backend Info --- src/index.ts | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/index.ts b/src/index.ts index b5a6249d..edcdb61c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,6 @@ import express, { Express, Request, Response } from "express"; import config from "./config"; import dotenv from "dotenv"; import cors from "cors"; -import passport from "./config/google.passport.config"; import { userRouter, authRoute, @@ -15,12 +14,10 @@ import { notificationRouter, productRouter, jobRouter, - paymentStripeRouter, blogRouter, adminRouter, exportRouter, sendEmailRoute, - paymentRouter, } from "./routes"; import { smsRouter } from "./routes/sms"; import { routeNotFound, errorHandler } from "./middleware"; @@ -50,15 +47,11 @@ server.use( }), ); -server.use(Limiter); -server.use(passport.initialize()); - server.use(Limiter); server.use(express.json()); server.use(express.urlencoded({ extended: true })); server.use(express.json()); - server.get("/", (req: Request, res: Response) => { res.send("Hello world"); }); @@ -67,7 +60,6 @@ server.use("/api/v1/users", userRouter); server.use("/api/v1/auth", authRoute); server.use("/api/v1", sendEmailRoute); server.use("/api/v1/sms", smsRouter); -server.use("/api/v1", orgRouter); server.use("/api/v1/help-center", helpRouter); server.use("/api/v1", exportRouter); server.use("/api/v1/sms", smsRouter); @@ -76,17 +68,11 @@ server.use("/api/v1/products", productRouter); server.use("/api/v1/blog", blogRouter); server.use("/api/v1", blogRouter); server.use("/api/v1/product", productRouter); -server.use("/api/v1/payments", paymentRouter); -server.use("/api/v1/payments/stripe", paymentStripeRouter); server.use("/api/v1/docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec)); server.use("/api/v1/settings", notificationRouter); server.use("/api/v1/jobs", jobRouter); server.use("/api/v1", orgRouter); server.use("/api/v1", authMiddleware, orgRouter); -server.use("/api/v1/", updateRouter); -server.use("/api-docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec)); -server.use("/api/v1/payments", paymentRouter); -server.use("/api/v1/jobs", jobRouter); server.use("/admin/queues", ServerAdapter.getRouter()); server.use(routeNotFound); @@ -100,10 +86,14 @@ AppDataSource.initialize() res.send("Hello world"); }); + server.use("/probe", (req: Request, res: Response) => { + res.send("I am the express api responding"); + }); + server.listen(port, () => { log.info(`Server is listening on port ${port}`); }); }) - .catch((error) => log.error(error)); + .catch((error) => console.error(error)); export default server; From bd9fd574c9f547a731283e32367e61e361632945 Mon Sep 17 00:00:00 2001 From: Adeosun Oluwaseyi Date: Sun, 28 Jul 2024 17:23:00 +0100 Subject: [PATCH 2/6] feat: Add /hng-test Page to Display Version and Backend Info --- src/controllers/ProductController.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/ProductController.ts b/src/controllers/ProductController.ts index a00de21a..bfe86c53 100644 --- a/src/controllers/ProductController.ts +++ b/src/controllers/ProductController.ts @@ -562,7 +562,7 @@ export class ProductController { } // For other types of errors - console.error("Error creating product:", error); + //console.error("Error creating product:", error); return res.status(500).json({ status: "unsuccessful", status_code: 500, From 7e01b4499f68c22fe9c4368ca12e5a7c88e14e38 Mon Sep 17 00:00:00 2001 From: Adeosun Oluwaseyi Date: Sun, 28 Jul 2024 17:47:37 +0100 Subject: [PATCH 3/6] feat: Add /hng-test Page to Display Version and Backend Info --- src/index.ts | 8 ++++++-- src/routes/probe.ts | 0 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/routes/probe.ts diff --git a/src/index.ts b/src/index.ts index edcdb61c..27feb648 100644 --- a/src/index.ts +++ b/src/index.ts @@ -86,8 +86,12 @@ AppDataSource.initialize() res.send("Hello world"); }); - server.use("/probe", (req: Request, res: Response) => { - res.send("I am the express api responding"); + server.get("/probe", (req, res) => { + try { + res.send("I am the express api responding"); + } catch (error) { + res.status(500).json({ error: "Internal Server Error" }); + } }); server.listen(port, () => { diff --git a/src/routes/probe.ts b/src/routes/probe.ts new file mode 100644 index 00000000..e69de29b From 69ed5b24515d110812b2c084330ddde66f8d2ab7 Mon Sep 17 00:00:00 2001 From: Adeosun Oluwaseyi Date: Sun, 28 Jul 2024 17:49:32 +0100 Subject: [PATCH 4/6] feat: Add /hng-test Page to Display Version and Backend Info --- src/routes/probe.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/routes/probe.ts diff --git a/src/routes/probe.ts b/src/routes/probe.ts deleted file mode 100644 index e69de29b..00000000 From fa3b2feb661ce3512ce25acd9a47406c35822a78 Mon Sep 17 00:00:00 2001 From: Adeosun Oluwaseyi Date: Sun, 28 Jul 2024 18:25:32 +0100 Subject: [PATCH 5/6] feat: Add /hng-test Page to Display Version and Backend Info --- src/index.ts | 1 - yarn.lock | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/index.ts b/src/index.ts index 39c21614..9254e9d8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -80,7 +80,6 @@ server.use("/api/v1", exportRouter); server.use("/api/v1", testimonialRoute); server.use("/api/v1", blogRouter); server.use("/api/v1/product", productRouter); -server.use("/api/v1/docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec)); server.use("/api/v1/settings", notificationRouter); server.use("/api/v1/jobs", jobRouter); server.use("/api/v1", orgRouter); diff --git a/yarn.lock b/yarn.lock index 1427e2f6..b1cf689f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1189,12 +1189,7 @@ resolved "https://registry.yarnpkg.com/@types/uuid-validate/-/uuid-validate-0.0.3.tgz#33f95a33ea776606862cc6eea3a8d49ccb90cba6" integrity sha512-htkuv1+RZjjHkSrXets3a6kqDeqgYutBtdER3U6I1mWV58AIsDFWoUuN0cB6DMOWiqTHK0XqH3pXeqIVfJIrog== -"@types/validator@^13.11.8": - version "13.12.0" - resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.12.0.tgz#1fe4c3ae9de5cf5193ce64717c99ef2fa7d8756f" - integrity sha512-nH45Lk7oPIJ1RVOF6JgFI6Dy0QpHEzq4QecZhvguxYPDwT8c93prCMqAtiIttm39voZ+DDR+qkNnMpJmMBRqag== - -"@types/validator@^13.12.0": +"@types/validator@^13.11.8", "@types/validator@^13.12.0": version "13.12.0" resolved "https://registry.yarnpkg.com/@types/validator/-/validator-13.12.0.tgz#1fe4c3ae9de5cf5193ce64717c99ef2fa7d8756f" integrity sha512-nH45Lk7oPIJ1RVOF6JgFI6Dy0QpHEzq4QecZhvguxYPDwT8c93prCMqAtiIttm39voZ+DDR+qkNnMpJmMBRqag== @@ -4548,6 +4543,13 @@ onetime@^6.0.0: dependencies: mimic-fn "^4.0.0" +onetime@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-7.0.0.tgz#9f16c92d8c9ef5120e3acd9dd9957cceecc1ab60" + integrity sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ== + dependencies: + mimic-function "^5.0.0" + open@^10.1.0: version "10.1.0" resolved "https://registry.yarnpkg.com/open/-/open-10.1.0.tgz#a7795e6e5d519abe4286d9937bb24b51122598e1" From 4276a0a96fbdaa1e8db6c12959db89fe6cc13d84 Mon Sep 17 00:00:00 2001 From: James Ayomikun Araoye Date: Mon, 29 Jul 2024 07:04:40 +0100 Subject: [PATCH 6/6] Update index.ts --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 13e3e741..4a8c5630 100644 --- a/src/index.ts +++ b/src/index.ts @@ -104,7 +104,7 @@ AppDataSource.initialize() server.get("/probe", (req: Request, res: Response) => { try { - res.send("I am the express api responding"); + res.send("I am the express api responding for team panther"); } catch (error) { res.status(500).json({ error: "Internal Server Error" }); }