Comparing version 1.1.7 to 1.1.8
// simplistic example application for nodulejs | ||
// see yukon for fully fleshed-out implementation (https://github.com/jackspaniel/yukon) | ||
@@ -3,0 +4,0 @@ var path = require('path'); |
{ | ||
"name": "nodulejs", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "Utility for discovering and initializing node/express 'nodules'", | ||
@@ -5,0 +5,0 @@ "main": "nodule.js", |
@@ -57,3 +57,3 @@ # nodulejs | ||
## Run Node Tests | ||
### To Run Node Tests | ||
``` | ||
@@ -66,3 +66,24 @@ $ npm install | ||
#### Example nodule | ||
#### Basic page | ||
([homePage.js](https://github.com/jackspaniel/nodulejs/blob/master/demo/submitForm.js) from the demoApp) | ||
``` | ||
// basic page example (serving multiple routes) | ||
module.exports = function(app) { | ||
return { | ||
// routes can be a string, RegExp or array of either (to match multiple routes) | ||
route: ['/', '/home', '/special'], | ||
doNoduleBusinessLogic: function(req, res) { | ||
this.debug('doNoduleBusinessLogic called'); | ||
// example of specifying a nodule property at request time | ||
this.templateName = (req.path.indexOf('special') > -1) | ||
? 'altHomePage.jade' | ||
: 'homePage.jade'; | ||
} | ||
}; | ||
}; | ||
``` | ||
#### Form submit | ||
([submitForm.js](https://github.com/jackspaniel/nodulejs/blob/master/demo/json/submitForm.js) from the demoApp) | ||
@@ -72,3 +93,2 @@ ``` | ||
return { | ||
// routes can be a string, RegExp or array of either (to match multiple routes) | ||
route : '/json/submitForm', | ||
@@ -95,3 +115,3 @@ | ||
#### Example nodule #2 | ||
#### Catch-all page | ||
([404 error nodule](https://github.com/jackspaniel/nodulejs/blob/master/demo/404.js) - shows routeIndex and one-off middleware) | ||
@@ -119,3 +139,3 @@ ``` | ||
#### Example of how to specify custom config and semi-global middleware | ||
#### Custom config with several nodule-dependent middleware chains, and extra nodule properties | ||
(from [demoApp.js](https://github.com/jackspaniel/nodulejs/blob/master/demo/demoApp.js)) | ||
@@ -164,3 +184,3 @@ ``` | ||
#### Example of semi-global middleware function which calls nodule-level function | ||
#### Middleware which calls nodule-level business-logic function | ||
(from [demoApp.js](https://github.com/jackspaniel/nodulejs/blob/master/demo/demoApp.js)) | ||
@@ -182,3 +202,3 @@ ``` | ||
#### Example of multiple middleware functions which make an asynchronous call to the DB | ||
#### Multiple middleware functions which make an asynchronous call to the DB (goes with Form submit example above) | ||
(from [demoApp.js](https://github.com/jackspaniel/nodulejs/blob/master/demo/demoApp.js)) | ||
@@ -185,0 +205,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40081
362
242