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

express-enrouten

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-enrouten - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

8

CHANGELOG.md

@@ -0,1 +1,9 @@

##### v0.2.1 - 20140210
**Bugs**
- Fix order of scanning and router placement to ensure middleware comes before router.
- Fix file scanning to support all registered/supported Node.js file extensions.
**Features**
- n/a
##### v0.2.0 - 20140127

@@ -2,0 +10,0 @@ **Bugs**

2

Gruntfile.js
/*───────────────────────────────────────────────────────────────────────────*\
│ Copyright (C) 2013 eBay Software Foundation │
│ Copyright (C) 2014 eBay Software Foundation │
│ │

@@ -4,0 +4,0 @@ │hh ,'""`. │

/*───────────────────────────────────────────────────────────────────────────*\
│ Copyright (C) 2013 eBay Software Foundation │
│ Copyright (C) 2014 eBay Software Foundation │
│ │

@@ -30,3 +30,18 @@ │hh ,'""`. │

function tryResolve(file) {
try {
// remove the file extension
var ext = path.extname(file);
if (ext) {
file = file.replace(new RegExp('\\' + ext + '$'), '');
}
// and use require.extensions to resolve known file types eg. CoffeeScript
require.resolve(file);
return true;
} catch (err) {
return false;
}
}
function scan(file, controllers) {

@@ -47,3 +62,3 @@ var stats;

});
} else if (stats.isFile() && file.match(/\.js$/i)) {
} else if (stats.isFile() && tryResolve(file)) {
controllers.push(file);

@@ -108,5 +123,9 @@ }

scan(app, settings);
// Reorganize stack to place router in correct place
// This could get out of whack if someone registers
// directly against express prior to calling enrouten
// directly against express prior to calling enrouten.
// This is done *after* scanning so any middleware registered
// during scanning is correctly put before the router.
app.stack.some(function (middleware, idx, stack) {

@@ -120,4 +139,2 @@ if (middleware.handle.name === 'router') {

});
scan(app, settings);
};

@@ -124,0 +141,0 @@ }

/***@@@ BEGIN LICENSE @@@***/
/*───────────────────────────────────────────────────────────────────────────*\
│ Copyright (C) 2013 eBay Software Foundation │
│ Copyright (C) 2014 eBay Software Foundation │
│ │

@@ -5,0 +5,0 @@ │hh ,'""`. │

{
"name": "express-enrouten",
"version": "0.2.0",
"version": "0.2.1",
"description": "An express route initialization and configuration module.",

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

@@ -8,4 +8,4 @@ express-enrouten

[![Build Status](https://travis-ci.org/paypal/express-enrouten.png)](https://travis-ci.org/paypal/express-enrouten)
[![NPM version](https://badge.fury.io/js/express-enrouten.png)](http://badge.fury.io/js/express-enrouten)
### API

@@ -22,3 +22,3 @@ #### `app.use(enrouten(options))`

~~#### `enrouten(app).withRoutes(options)`~~
#### **Deprecated:** ~~`enrouten(app).withRoutes(options)`~~
```javascript

@@ -83,4 +83,4 @@ var express = require('express'),

### Controller Files
A 'controller' is defined as any javascript file (extension of `.js`) which exports a function that accepts a single argument.
**NOTE: Any file in the directory tree that matches the API will be invoked/initialized with the express application object.**
A 'controller' is defined as any `require`-able file which exports a function that accepts a single argument. Any files with an extension of `.js` (or `.coffee` if CoffeeScript is registered) will be loaded and if it exports a function that accepts a single argument then this function will be called. **NOTE: Any file in the directory tree that matches the API will be invoked/initialized with the express application object.**
```javascript

@@ -87,0 +87,0 @@ // Good :)

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