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

rainbow

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rainbow - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

11

index.js

@@ -32,5 +32,6 @@ var approot = process.env.PWD;

app[method].apply(app, [joinParam(url, router.params)]
app[method.toLowerCase()].apply(app, [joinParam(url, router.params)]
.concat(filters)
.concat([router]));
.concat([router])
);
}

@@ -50,4 +51,8 @@

methods.forEach(function (method) {
var eachRouter = router[method];
var eachRouter = router[method.toLowerCase()] || router[method.toUpperCase()];
if (eachRouter) {
if (method != method.toUpperCase()) {
console.log('npm rainbow: Lower case HTTP methods are deprecated. Please change ' + method + ' to upper case.');
}
route(app, method, url, eachRouter);

@@ -54,0 +59,0 @@ }

{
"name": "rainbow",
"description": "Express router middleware for RESTful API base on certain folder path",
"version": "0.2.1",
"version": "0.3.0",
"author": "mytharcher <mytharcher@gmail.com>",

@@ -9,3 +9,3 @@ "main" : "index.js",

"glob": "3.x",
"methods": "0.0.1"
"methods": "1.x"
},

@@ -12,0 +12,0 @@ "keywords": [

@@ -41,3 +41,3 @@ Rainbow

```javascript
exports.get = function (req, res, next) {
exports.GET = function (req, res, next) {
res.send(200, 'Simple getting.');

@@ -50,7 +50,7 @@ };

```javascript
exports.get = function (req, res, next) {
exports.GET = function (req, res, next) {
res.send(200, 'Simple getting.');
};
// add filters
exports.get.filters = ['authorization'];
exports.GET.filters = ['authorization'];
```

@@ -61,3 +61,3 @@

```javascript
exports.get = function (req, res, next) {
exports.GET = function (req, res, next) {
User.find({where: req.query.name}).success(function (user) {

@@ -68,3 +68,3 @@ res.send(200, user);

exports.put = function (req, res, next) {
exports.PUT = function (req, res, next) {
User.create(req.body).success(function (user) {

@@ -90,3 +90,3 @@ res.send(201, user.id);

```coffeescript
exports.get = (req, res, next) ->
exports.GET = (req, res, next) ->
User.find(where: req.query.name)

@@ -96,3 +96,3 @@ .success (user) ->

exports.put = (req, res, next) ->
exports.PUT = (req, res, next) ->
User.create(req.body)

@@ -108,3 +108,3 @@ .success (user) ->

```javascript
exports.get = function (req, res, next) {
exports.GET = function (req, res, next) {
var id = req.params.id;

@@ -114,3 +114,3 @@ // your business

exports.get.params = ':id?';
exports.GET.params = ':id?';
```

@@ -121,7 +121,7 @@

```javascript
exports.get = function (req, res, next) {
exports.GET = function (req, res, next) {
console.log(req.params);
}
exports.get.params = /(\d+)(?:\.\.(\d+))?/;
exports.GET.params = /(\d+)(?:\.\.(\d+))?/;
```

@@ -128,0 +128,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