From 520b191da0635987051ea7a4f90a820b38e80132 Mon Sep 17 00:00:00 2001 From: Astrian Zheng Date: Sun, 12 Jan 2025 11:42:15 +1100 Subject: [PATCH] feat: add route to retrieve invoice details by ID and suffix --- backend/src/app.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/app.ts b/backend/src/app.ts index 4c8091f..e519272 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -143,6 +143,10 @@ app.use(route.post('/invoice', async (ctx) => { ctx.status = 204 })) +app.use(route.get('/invoice/INV-:date(\\d{8})-:suffix(\\d+)', async (ctx, invoiceId, suffix) => { + ctx.body = `Invoice ID: INV-${invoiceId}-${suffix}` +})) + const port = parseInt(process.env.PORT ?? '3000') app.listen(port, () => { console.log(`Server is running at http://localhost:${port}`)