Skip to content

Commit bdef401

Browse files
committed
refactor(api): Rename and reorganize API handlers for better structure
1 parent 4453db0 commit bdef401

File tree

9 files changed

+24
-22
lines changed

9 files changed

+24
-22
lines changed

src/api/app.handler.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Request, Response } from 'express';
2+
3+
export function getHealthzHandler() {
4+
return async (req: Request, res: Response) => {
5+
res.json({ message: 'ok' });
6+
};
7+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/api/job.ts

Whitespace-only changes.

src/api/notification.handler.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Request, Response } from 'express';
2+
3+
export function postNotificationHandler() {
4+
return async (req: Request, res: Response) => {
5+
console.log(req.body);
6+
7+
res.json({
8+
success: true,
9+
message: 'Notification created and queued successfully',
10+
notificationId: 'generated_uuid',
11+
jobId: 'generated_job_id',
12+
channels: ['email', 'sms'],
13+
});
14+
};
15+
}

src/api/notification.ts

Whitespace-only changes.

src/handler.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/router.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import express from 'express';
22
import { catchAsyncErrorMiddleware } from './middleware';
3-
import { getHealthzHandler, postNotificationHandler } from './handler';
3+
import { getHealthzHandler } from './api/app.handler';
4+
import { postNotificationHandler } from 'api/notification.handler';
45

56
const router = express.Router();
67

0 commit comments

Comments
 (0)