Thursday, 15 July 2010

node.js - Use dynamic express routes within another Express route -


For a school project, I have created a plugin for the application in an express.jis-node.js. The main page of the application should display a dashboard, where each root page of each plugin should be displayed in a div. Each root page is accessible on PluginName / Root.

What I would like to do is the following: I want to include the HTML-string of each home-root in the dashboard. But for this, let me node. There is a need to call routes within JS (partially) and for some plugins I also have to provide some properties.

Does anyone have an idea, how can this be implemented? / P>

For example, I have a route:

  router.get ('/ pluginname', function (rik, ridge) {res.render (__DERNAM + '/ view / email / Handlabar ', {layout: __dirname +' / views / layouts / main.handlebars', markup: markup // pass remarket markup});});  

Now I want to pass the resulting HTML from this route to another.

So far I had the following thoughts:

  1. Just add the URL of the plugins for the "Data-ajax-url" attribute of the Divis and the goods through AJX Load from
  2. Make an HTTP call on every route and add results to server side (too bad ...).
  3. Create a render dashboard-function for each plugin, where I'm going to app. HTML is found using render (...) and then I add results.

But I'm not sure which approach (if any) would be best.


No comments:

Post a Comment