Socket
Socket
Sign inDemoInstall

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.15 to 1.1.16

2

package.json
{
"name": "nodulejs",
"version": "1.1.15",
"version": "1.1.16",
"description": "Utility for discovering and initializing node/express 'nodules'",

@@ -5,0 +5,0 @@ "main": "nodule.js",

@@ -8,2 +8,4 @@ # nodulejs

For a fully fleshed-out implementation of nodulejs, see the [yukon API framework](https://github.com/jackspaniel/yukon)).
## Installation

@@ -29,9 +31,8 @@ ```

## What is a nodule?
A nodule is a self-discovering, self-initializing component that would be analagous to a JSP or PHP page in those worlds. Except it has an advanatage in that its route is declared, not tied by default to the file name or file structure. So you are free to re-organize nodules without upsetting urls. But more importantly, because nodules are self-discovering, there are no onerous config files to maintain (IE - spring). This system allows a much more scalable architecture on large sites--as there are no config or other shared files which grow to enormous sizes as the site grows, and nodules can be re-organized, placed into subfolfders, etc. with zero impact.
A nodule is a self-discovering, self-initializing component that would be analagous to a JSP or PHP page in those worlds. Except it has an advanatage in that its route is declared, not tied by default to the file name or file structure. So you are free to re-organize nodules without upsetting urls. But more importantly, because nodules are self-discovering, there are no onerous config files to maintain (IE - Spring). This system allows a much more scalable architecture on large sites--as there are no config or other shared files which grow to enormous sizes as the site grows, and nodules can be re-organized, placed into subfolfders, etc. with zero impact.
### What does a nodule do?
Not a whole lot out of the box. See the [yukon API framework](https://github.com/jackspaniel/yukon) for a fully-fleshed out implementation. I split nodulejs off from yukon with the idea that it can potentially be a building block for other frameworks.
A nodule can have any properties you want to add, which will be propagated throughout the middleware chaing as as req.nodule. But nodulejs only cares about 4 core properties, which are needed to register express middleware at app-init time:
A nodule can have any properties you want to add, which will be propagated throughout the middleware chain as as req.nodule. But nodulejs only cares about 4 core properties, which are needed to register express middleware at app-init time:

@@ -65,4 +66,4 @@ 1. __route__: <span style="color:grey">(REQUIRED)</span> *one or more express routes - can be a string, RegExp, or array of either*

#### Basic page
([homePage.js](https://github.com/jackspaniel/nodulejs/blob/master/demo/submitForm.js) from the demoApp)
```
([homePage.js](https://github.com/jackspaniel/nodulejs/blob/master/demo/homePage.js) from the demoApp)
```js
module.exports = function(app) {

@@ -83,3 +84,3 @@ return {

([submitForm.js](https://github.com/jackspaniel/nodulejs/blob/master/demo/json/submitForm.js) from the demoApp)
```
```js
module.exports = function(app) {

@@ -105,3 +106,3 @@ return {

([404 error nodule](https://github.com/jackspaniel/nodulejs/blob/master/demo/404.js) - shows routeIndex and one-off middleware)
```
```js
module.exports = function(app) {

@@ -125,3 +126,3 @@ return {

(from [demoApp.js](https://github.com/jackspaniel/nodulejs/blob/master/demo/demoApp.js) - shows defining several nodule-dependent middleware chains at app init time, and adding extra nodule properties)
```
```js
var config = {

@@ -160,3 +161,3 @@

(from [demoApp.js](https://github.com/jackspaniel/nodulejs/blob/master/demo/demoApp.js))
```
```js
function doBusinessLogic(req, res, next) {

@@ -177,3 +178,3 @@ debug('doBusinessLogic middleware executed for: ' + req.nodule.name);

(from [demoApp.js](https://github.com/jackspaniel/nodulejs/blob/master/demo/demoApp.js) - goes with Form submit example above)
```
```js
...

@@ -213,2 +214,5 @@ middlewares: function(nodule) {

# License
### MIT
[npm-image]: https://img.shields.io/npm/v/nodulejs.svg?style=flat

@@ -215,0 +219,0 @@ [npm-url]: https://www.npmjs.com/package/nodulejs

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