I am new to Azure functions. Is there a way to use one function to represent 2 scenarios: No ID or with an ID? The code below give a 404 on No ID. Thanks!
No ID: http://localhost:7071/api/orders/
With ID: http://localhost:7071/api/orders/21345678654/
app.http('orders', {
methods: ['GET', 'POST'],
authLevel: 'anonymous',
route:'orders/{id}',
handler: async (request, context) => {
context.log(`Http function processed request for url "${request.url}"`);
const name = request.query.get('name') || await request.text() || 'world';
return { body: `Hello!!!!, ${name}!` };
}
});