I'm in the process of creating a basic app using expressJS to retrieve user data (similar to an API). I currently have a /users route set up to fetch all users, which is functioning correctly.
app.get('/users', (req: express.Request, res: express.Response)
Now, I want to include an optional parameter called limit to limit the number of records returned. For instance:
app.get('/users?limit=5', (req: express.Request, res: express.Response)
However, it's important that the limit parameter remains optional, so that URLs like /users, /users?limit=5, or /users/limit/5 will all work as expected.
Thank you.