BorisMoore / jsviews

Interactive data-driven views, MVVM and MVP, built on top of JsRender templates
http://www.jsviews.com/#jsviews
MIT License
856 stars 130 forks source link

jsviews in node/serverside? #359

Closed puppetmaster3 closed 7 years ago

puppetmaster3 commented 7 years ago

I am looking here: https://www.npmjs.com/package/jsviews jsrender runs on node (not just browser).

Does jsview work in node/serverside?

BorisMoore commented 7 years ago

JsRender can run on the server. It renders to string, and does not need jQuery.

But JsViews inserts content in the DOM, and uses jQuery, so it does not make sense to run it on the server. It runs in the browser and provides dynamic data-driven UI.

JsViews can nevertheless be installed using NPM. This is a recommended install method even for jQuery plugins that do not run on the server. See http://plugins.jquery.com/

You can create an app which uses JsRender on the server to render pages, and then uses JsViews in the browser to provide dynamic interactivity (e.g. a single page app) using the same templates. See the following links and docs:

http://www.jsviews.com/#node/server-browser (See JsRender on the server, JsRender or JsViews in the browser...)

Examples of this are available here: https://github.com/BorisMoore/jsrender-node-starter#demo-pages

puppetmaster3 commented 7 years ago

It's clear, thx. I assume I can render array/JSON in JsRender.

BorisMoore commented 7 years ago

You can render JavaScript objects or arrays (or hierarchies of...).