New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

connect-rest

Package Overview
Dependencies
Maintainers
1
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-rest - npm Package Compare versions

Comparing version 0.9.2 to 0.9.3

2

lib/path.js

@@ -12,3 +12,3 @@ var PARAMETER_M_DELIMETER = ':';

this.context = this.isObject && path.context ? path.context : context;
this.context = this.isObject && (path.context || path.context === '') ? path.context : context;

@@ -15,0 +15,0 @@ if( this.isObject ){

{
"name": "connect-rest",
"version": "0.9.2",
"version": "0.9.3",
"description": "Exceptionally featureful RESTful web services middleware for Connect.",

@@ -50,3 +50,3 @@ "keywords": [

},
"_id": "connect-rest@0.9.2"
"_id": "connect-rest@0.9.3"
}

@@ -25,3 +25,2 @@ [connect-rest](https://github.com/imrefazekas/connect-rest) is a featureful very easy-to-use middleware for [connect](http://www.senchalabs.org/connect/) for building REST APIs. The library has a stunning feature list beyond basic rest functionality.

If [bodyparser](http://www.senchalabs.org/connect/bodyParser.html) or [json](http://www.senchalabs.org/connect/json.html) or any similar connect middleware is being used creating the req.body attribute, its content will be respected and delegated to the service functions as it is.

@@ -33,2 +32,3 @@ # Installation

## Features:
- [Quick usage](#quick-setup)
- [Assign](#assign)

@@ -59,6 +59,37 @@ - [Path description](#path-description)

- [Monitoring](#monitoring)
- [File Upload](#file-upload)
- [Usage](#usage)
- [Changelog](#changelog)
## Quick setup
var connect = require('connect');
var rest = require('connect-rest');
var connectApp = connect();
.use( connect.query() )
.use( connect.urlencoded() )
.use( connect.json() )
;
var options = {
apiKeys: [ '849b7648-14b8-4154-9ef2-8d1dc4c2b7e9' ],
discoverPath: 'discover',
protoPath: 'proto',
logger: 'connect-rest',
logLevel: 'debug',
context: '/api'
};
connectApp.use( rest.rester( options ) );
rest.get('/books/:title/:chapter', functionN0 );
rest.post( { path: '/make', version: '>=1.0.0' }, functionN1 );
rest.post( [ '/act', '/do' ], functionN2 );
rest.post( [ { path: '/shake', version: '>=2.0.0' }, { path: '/twist', version: '>=2.1.1' } ], functionN3 );
[Back to Feature list](#features)
## Assign

@@ -520,46 +551,2 @@ Assign your rest modules by one of the http request functions: head, get, post, put, delete.

## File upload
The connect [bodyparser](http://www.senchalabs.org/connect/middleware-bodyParser.html) middleware manages content parsing for a given request. To manage the upload of files, your task is very simple:
rest.post( '/upload', function( request, content, callback ){
console.log( 'Upload called:' + JSON.stringify( request.files ) );
return callback(null, 'ok');
} );
The middleware manages the file storage and every stored file can be found in the _files_ attribute of _request_ object. For further configuration, please find the [bodyparser's page](http://www.senchalabs.org/connect/middleware-bodyParser.html).
[Back to Feature list](#features)
## Usage
var connect = require('connect');
var rest = require('connect-rest');
var connectApp = connect();
connectApp.use( connect.bodyParser({ uploadDir: './storage' }) );
connectApp.use( connect.query() );
var options = {
apiKeys: [ '849b7648-14b8-4154-9ef2-8d1dc4c2b7e9' ],
discoverPath: 'discover',
protoPath: 'proto',
logger: 'connect-rest',
logLevel: 'debug',
context: '/api'
};
connectApp.use( rest.rester( options ) );
rest.get('/books/:title/:chapter', functionN0 );
rest.post( { path: '/make', version: '>=1.0.0' }, functionN1 );
rest.post( [ '/act', '/do' ], functionN2 );
rest.post( [ { path: '/shake', version: '>=2.0.0' }, { path: '/twist', version: '>=2.1.1' } ], functionN3 );
[Back to Feature list](#features)
## License

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