render-html-async
This is a template render engine. This is very light. This engine substitutes the query string parameters of url to inside the html page and renders it
Usage
HTML page
observe {{key}}
symbol they contain keys of url querystring.
Document {{name}} {{age}}
method renderHTML
Method renderHTML takes two arguments and callback
-
path
path
arguments is physical path in folder. -
url
a. This could be querystring?name=Umesh&age=45&gender=male
b. This couild object i.e
{name : "umesh", age : 45, gender : "male"}
in above example name and gender are keys{{key}}
is key of arguments these get replaced after rendering -
callback
This is call function with err as first argument and data as second argument( html string); -
partials
are also added. see below
var render = ;//include in your module test
method getParsedQueryString
This method returns json object from url with querystring
var url = "./index?name=umesh&age=49"; var queryJSON = render;
method createQueryString
This method creates queryString from json object
var jsonobj = "name" : "Anthony" "age" : 35 "sex" : "nale" var queryString = render;
Partials
First add Partials
test; test;
create html partials(templates)
- header Partial
{{get(header)}}
Document
- footer Partial
{{get(footer)}}
- acutual page with conatin this code
{{get(header)}}{{name}}{{age}}{{get(footer)}}
- call render method
test