I have declared route using fastify as follows:
const apiService = require('./apiService');
try {
server.get('/api/status/*', apiService);
} catch (err) {
console.log(err);
process.exit(1);
}
My api service is defined as follows:
async function entryFunc(request, response) {
try {
console.log("Params are ");
console.log(request.params);
} catch (err) {
console.log(err);
}
}
I am getting following output when calling api http://localhost:3002/api/status/1/2
:
Params are:
{ '*': '1/2' }
The url can have infinite number of parth params
and that is why I am using wildcard
in my route
I want to modify entryFunc(request, response)
such that the values 1
and 2
are stored in an array and when I print array[0]
I should get value as 1