Skip to content

Commit

Permalink
add jsdoc for swagger docs
Browse files Browse the repository at this point in the history
  • Loading branch information
willpinha committed May 14, 2024
1 parent 29034f2 commit 01b7132
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/controllers/hello.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ import { JSend } from "@/utils/jsend";
import { validate } from "@/utils/validation";
import { getHelloMessage } from "@/services/hello.service";

/**
* @swagger
* /api/hello:
* post:
* description: Get a hello message
* responses:
* 200:
* description: Returns a hello message from the sender to the receiver
* 400:
* description: Invalid request body
*/
const controller: RequestHandler = async (req, res) => {
const { receiver, customPrefix } = await validate(
req.body,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/swagger.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const specOptions = {
version: "1.0.0",
},
},
apis: ["../*.ts"],
apis: ["../**/*.ts"],
};

const uiOptions = {
Expand Down
2 changes: 1 addition & 1 deletion src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ const router = express.Router();

router.get("/docs/swagger.json", (req, res) => res.json(swaggerSpec));
router.use("/docs", swaggerServe, swaggerSetup);
router.post("/hello", fooMiddleware, helloController);
router.get("/hello", fooMiddleware, helloController);

export default router;

0 comments on commit 01b7132

Please sign in to comment.