Currently struggling with a issue with express, node.js (and mongoose). I have set up a lot of REST functions that I can redirect to that is working.
From my app.js:
app.get('/users', user.list);
app.get('/points', activityList.showActivities.bind(activityList));
app.get('/', activityList.showActivities.bind(activityList));
My issue/problem is that I want to make REST-calls to these functions without redirecting me to another page. For example I want to use the results of a call to '/users' to be used in a drop down menu, and the result of '/points' to be used in another one on the same page.
I want to use these data together in my index.jade site. The flow right now is such that a user goes to '/' (index.jade) , the showActivities gets called, which renders the index page and binds some data (from a mongoose call).
However I want it to call the others also and present these data as well.
Please feel free to come with suggestions. Any tips is greatly appreciated. Thanks
Found the answer! I had to use nested loopback queries and return them.