The incoming HTTP request.
The path template of the matched route.
An object containing the extracted parameters.
Example usage:
import { router, text, getPathParams } from "@pulsar-http/core";
const myRoute = router.get('/api/users/:id', async () => text('User List'));
// Fake the request for the example
const request = new Request('http://localhost:3000/api/users/123');
const params = getPathParams(request, myRoute.path);
In this example, params
will be:
{
id: "123",
}
Extracts parameters from the request URL based on the route path.