I am building my first app with node.js.
This app uses Express as the web application framework with Jade template engine.
I need to design a screen which displays list of items retrieved from a MongoDB database.
Initially while displaying list of items data is sent from controller and formatting is done in jade template.
However, I also need to update list of items via an ajax call.
I am finding it difficult to design a suitable approach for this particular flow.
I have following option:
- Send list of items from in ajax response.
- Use javascript to render UI components - adding css class, preparing html.
However this approach is very fragile. Also a lot of code would be exposed in web browser.
I am coming from JSF that has re-render of components, a built-in feature.
Can node.js, ajax and re-render be clubbed together ?
You should use modern client-side web development frameworks like AngularJS, which will do all of this automatically.