From be9206767dae6ef280e24a7b7cce168d62475ecd Mon Sep 17 00:00:00 2001 From: paulr Date: Sun, 30 Dec 2012 22:12:24 +1100 Subject: [PATCH] added a readme --- Readme.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-) create mode 100644 Readme.md diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..15afed4 --- /dev/null +++ b/Readme.md @@ -0,0 +1,39 @@ +NJSPURLS +======== + +Stands for "Node JS, Primary URL Servicer". It is a simple web framework that provides +and overhead for createing web applications based on the basic URL. There are manu +default parts that are used when servicing a web based applications. + +How It Works +============ + +In NodeJS you define a layout using NJS script (html with tags that define purls that +are called to render pages). For EG if i wanted to create a page "http://host/mypage" +then i create a file called ./purls/mypage.js and inside this file i might create the +following: + +exports.layout = function(request, response) { + var layout = "<?njs title ?>"; + + return layout; +} + +exports.title = function(request, response, callback) { + response.write("i am a title"); + callback(); +} + +exports.body = function(request, response, callback) { + response.write("i am a body"); + callback(); +} + +A request to http://localhost:8888/mypage will create html that looks like so: + +i am a titlei am a body + +and it does this by printing out the layout then reaplcing the bits +with the functions in the purl defined with the same name of the tag. For EG + means call the exported function "body" from mypage.js. Defaults +also do exist, and so you dont necessarily have to define your own everytime. \ No newline at end of file -- 1.7.0.4