samedi 27 juin 2015

complex nodejs url mapping

I need help in url mapping in express.js framework in nodejs.

router.get('/first/:second_param', function(res,req){
    //processing second_param and rendering a template,
res.render('first.html');
});

router.get('/first/:second_param/get_items', function(res,req){
    //again evaluating second_param and and responding accordingly
res.send(jsonData);
});

Is this kind of routing possible in Express 4.0?

first.html makes a ajax request at url './get_items'

Aucun commentaire:

Enregistrer un commentaire