diff --git a/src/handler.ts b/src/handler.ts index ac82b9b..40ba88e 100644 --- a/src/handler.ts +++ b/src/handler.ts @@ -8,6 +8,7 @@ export function getHealthzHandler() { export function postNotificationHandler() { return async (req: Request, res: Response) => { - res.json({ message: 'postNotificationHandler()' }); + console.log(req.body); + res.json({ message: 'ok' }); }; } diff --git a/src/scratch.js b/src/scratch.js new file mode 100644 index 0000000..3f07b71 --- /dev/null +++ b/src/scratch.js @@ -0,0 +1,27 @@ +async function main() { + try { + const response = await fetch('http://localhost', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'X-API-Key': '42069247355', + }, + body: JSON.stringify({ + id: 69, + message: 'Hello, this is a test message', + details: { + name: 'John Doe', + age: 30, + email: 'john.doe@example.com', + }, + }), + }); + + const data = await response.json(); + console.log(data); + } catch (error) { + console.error('Error:', error); + } +} + +main();