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.0 to 1.1.1

21

nodule.js

@@ -13,10 +13,17 @@ var glob = require('glob');

// directories to look for nodules in, minus exclude pattern
// directories to look for nodules in, minus exclude pattern - looks in nodules directory by default
dirs: [
{ path: process.cwd(), exclude: null }
{ path: path.join(process.cwd(), 'nodules'), exclude: null }
],
noduleDefaults: {
// the array of middleware functions which will be called in order for each nodule
// array of (or function which returns array of) middleware functions which will be called in order for each nodule on each express request
middlewares: [],
// - use a function if you want to specify different groups of middleware based on certain nodule properties when app inits
// - but be careful because most nodule properties can be mutated at request time - whereas middleware chains are set up at app init time
// function example (use 'this' to reference current nodule):
// middlewares: function() {
// if (this.routeVerb === 'post') return formMiddleWareArray; // predefined middleware array just for post requests
// else return middleWareArray; // standard middleware array used for everything else
// },

@@ -64,5 +71,5 @@ // NOTE: the three route config params below must be specified in the nodule init method, they cannot be mutated at request-time

if (!routes[seedNodule.routeIndex])
routes[seedNodule.routeIndex] = [];
routes[seedNodule.routeIndex].push({path:routePath, verb:seedNodule.routeVerb, middlewares:seedNodule.middlewares});
var middlewares = typeof seedNodule.middlewares === 'function' ? seedNodule.middlewares() : seedNodule.middlewares;
if (!routes[seedNodule.routeIndex]) routes[seedNodule.routeIndex] = [];
routes[seedNodule.routeIndex].push({path:routePath, verb:seedNodule.routeVerb, middlewares:middlewares});
});

@@ -87,3 +94,3 @@ }

function initRequest(req, res, next) {
req.module = _.cloneDeep(seedNodules[req.route.path]);
req.nodule = _.cloneDeep(seedNodules[req.route.path]);
next();

@@ -90,0 +97,0 @@ }

{
"name": "nodulejs",
"version": "1.1.0",
"version": "1.1.1",
"description": "Utility for discovering and initializing node/express 'nodules'",

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

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