For the code below:
router.use('/campaigns/:campaign_uid', cache.node_cache, api_dynamic_campaign.router);
I have a router route to another router which looks like this:
router.get('/data.json', campaigns);
The handler looks like this:
function campaigns(request, response){
var campaign = api.get_campaign_from_request(request) || request.params.campaign_uid;
api.route_handler(request, response, {"campaign":campaign});
}
My issue is the handler does not have access to campaign_uid in the request.params. How do I access/pass the campaign_uid to the handler?
router.get('/data.json', campaigns).Router({ mergeParams: true })
https://cedric.tech/blog/expressjs-accessing-req-params-from-child-routers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With