feat: add route to retrieve invoice details by ID and suffix

This commit is contained in:
Astrian Zheng 2025-01-12 11:42:15 +11:00
parent ac53c3c6cf
commit 520b191da0
Signed by: Astrian
SSH Key Fingerprint: SHA256:rVnhx3DAKjujCwWE13aDl7uV6+9U1MvydLkNRXJrBiA

View File

@ -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}`)