4 Stands for "Node JS, Primary URL Servicer". It is a simple web framework that provides
5 and overhead for createing web applications based on the basic URL. There are manu
6 default parts that are used when servicing a web based applications.
11 In NodeJS you define a layout using NJS script (html with tags that define purls that
12 are called to render pages). For EG if i wanted to create a page "http://host/mypage"
13 then i create a file called ./purls/mypage.js and inside this file i might create the
16 exports.layout = function(request, response) {
17 var layout = "<html><head><title><?njs title ?></title><body><?njs body ?></body></html>";
22 exports.title = function(request, response, callback) {
23 response.write("i am a title");
27 exports.body = function(request, response, callback) {
28 response.write("i am a body");
32 A request to http://localhost:8888/mypage will create html that looks like so:
34 <html><head><title>i am a title</title></head><body>i am a body</body></html>
36 and it does this by printing out the layout then reaplcing the <?njs ... ?> bits
37 with the functions in the purl defined with the same name of the tag. For EG
38 <?njs body ?> means call the exported function "body" from mypage.js. Defaults
39 also do exist, and so you dont necessarily have to define your own everytime.