Skip to content

Commit

Permalink
fix: 🐻 app api
Browse files Browse the repository at this point in the history
  • Loading branch information
BharathSanjeeviT committed Feb 26, 2024
2 parents 2f388f3 + 85b2775 commit 7f5e7e6
Show file tree
Hide file tree
Showing 7 changed files with 454 additions and 15 deletions.
3 changes: 0 additions & 3 deletions api/index.ts

This file was deleted.

Empty file removed public/.gitkeep
Empty file.
432 changes: 432 additions & 0 deletions src/controllers/sesController.ts

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import express from "express";
import cors from "cors";
import { PORT } from "../config/port.js";
import { Admin, Events, Users} from "./routes/index.js";
import { Admin, Events, Users, Support } from "./routes/index.js";
import errorHandler from "./middlewares/errorHandler.js";
import { AuthourizeAdmin, AuthourizeUser } from "./middlewares/authHandler.js";
import serverless from "serverless-http";
Expand All @@ -22,21 +22,15 @@ app.use(cors(corsOptions));

app.use(express.json());

app.get("/say", (req, res)=>{
return res.status(200).send({
"hello": "world"
})
})

app.use(Events.BASE_ROUTE, AuthourizeAdmin, Events.router);
app.use(Users.BASE_ROUTE, AuthourizeUser, Users.router);
app.use(Admin.BASE_ROUTE, Admin.router);
app.use(Support.BASE_ROUTE, Support.router);

app.use(errorHandler);

// app.listen(PORT, () => {
// console.log(`PORT RUNNING ON ${PORT}`);
// });
export default app;

// export const handler = serverless(app);
export const handler = serverless(app);
1 change: 1 addition & 0 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as Users } from "./userRoute.js";
export { default as Events } from "./eventsRoute.js";
export { default as Admin } from "./adminRoute.js";
export { default as Support } from "./sesRoute.js";
18 changes: 18 additions & 0 deletions src/routes/sesRoute.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import express from "express";
import { Module } from "../../libs/utils/types/module.js";
import {Paid, Registered,Emergency,Sendotp } from "../controllers/sesController.js";
import asyncMiddleware from "../middlewares/asyncMiddleware.js";

const router = express.Router();
const BASE_ROUTE = "/support";

router.post("/registered", asyncMiddleware(Registered));
router.post("/paid", asyncMiddleware(Paid));
router.post("/emergency", asyncMiddleware(Emergency));
router.post("/sendotp", asyncMiddleware(Sendotp));

const MODULE: Module = {
router,
BASE_ROUTE,
};
export default MODULE;
3 changes: 0 additions & 3 deletions vercel.json

This file was deleted.

0 comments on commit 7f5e7e6

Please sign in to comment.