Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nodulejs

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodulejs - npm Package Compare versions

Comparing version 1.1.7 to 1.1.8

1

demo/demoApp.js
// 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');

2

package.json
{
"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 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc