Skip to content

Commit 33e1feb

Browse files
committed
feat(src): Add postNotificationHandler functionality and create scratch.js
1 parent 3f62b24 commit 33e1feb

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/handler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export function getHealthzHandler() {
88

99
export function postNotificationHandler() {
1010
return async (req: Request, res: Response) => {
11-
res.json({ message: 'postNotificationHandler()' });
11+
console.log(req.body);
12+
res.json({ message: 'ok' });
1213
};
1314
}

src/scratch.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
async function main() {
2+
try {
3+
const response = await fetch('http://localhost', {
4+
method: 'POST',
5+
headers: {
6+
'Content-Type': 'application/json',
7+
'X-API-Key': '42069247355',
8+
},
9+
body: JSON.stringify({
10+
id: 69,
11+
message: 'Hello, this is a test message',
12+
details: {
13+
name: 'John Doe',
14+
age: 30,
15+
email: 'john.doe@example.com',
16+
},
17+
}),
18+
});
19+
20+
const data = await response.json();
21+
console.log(data);
22+
} catch (error) {
23+
console.error('Error:', error);
24+
}
25+
}
26+
27+
main();

0 commit comments

Comments
 (0)