Comparing version 0.3.3 to 1.0.0
22
index.js
"use strict"; | ||
module.exports.Receiver = require( './lib/receive' ); | ||
module.exports.Sender = require( './lib/send' ); | ||
module.exports.Receiver = require( './lib/receiver' ); | ||
@@ -15,1 +14,20 @@ module.exports.transports = { | ||
}; | ||
// convenience method for creating a receiver. | ||
module.exports.createReceiver = function( params ) { | ||
params = params || {}; | ||
var transConfig = params.transports; | ||
var receiver = new this.Receiver( { | ||
baseDir: params.baseDir | ||
} ); | ||
for ( var name in transConfig ) { | ||
if ( transConfig.hasOwnProperty( name ) && this.transports.receivers.hasOwnProperty( name ) ) { | ||
receiver.addTransport( new this.transports.receivers[ name ]( transConfig[ name ] ) ); | ||
} | ||
} | ||
return receiver; | ||
}; |
@@ -5,2 +5,3 @@ "use strict"; | ||
var express = require( 'express' ); | ||
var bodyParser = require( 'body-parser' ); | ||
var Request = require( './request' ); | ||
@@ -10,5 +11,6 @@ var Response = require( './response' ); | ||
var ExpressReceiverTransport = function( config ) { | ||
AbstractReceiverTransport.apply( this, arguments ); | ||
this._server = this._config.express; | ||
this._server = this._config.app; | ||
this._url = this._config.url; | ||
@@ -22,4 +24,6 @@ | ||
var self = this; | ||
self._server.post( self._url, express.json(), function( httpRequest, httpResponse ) { | ||
var router = express.Router(); | ||
router.post( '/', bodyParser.json(), function( httpRequest, httpResponse ) { | ||
var request = new Request( httpRequest.body, httpRequest ); | ||
@@ -49,17 +53,4 @@ var response = new Response( request.getId() ); | ||
setImmediate( done, null ); | ||
self._server.use( self._url, router ); | ||
}; | ||
ExpressReceiverTransport.prototype.dinit = function( done ) { | ||
var routes = this._server.routes; | ||
for ( var i = 0; i < routes.length; i++ ) { | ||
if ( routes[i].path === this._url ) { | ||
delete routes[i]; | ||
break; | ||
} | ||
} | ||
setImmediate( done, null ); | ||
@@ -66,0 +57,0 @@ |
{ | ||
"name": "fling", | ||
"description": "JSON Fling is a simple JSON-RPC framework for NodeJS with built-in permissions and support for different transports.", | ||
"version": "0.3.3", | ||
"version": "1.0.0", | ||
"author": "Anthony Hildoer <anthony@bluerival.com>", | ||
@@ -11,9 +11,9 @@ "repository": { | ||
"dependencies": { | ||
"async": "~0.2", | ||
"express": "~3.4", | ||
"request": "~2.34" | ||
"async": "~0.2", | ||
"body-parser": "~1.0", | ||
"express": "~4.9", | ||
"request": "~2.34" | ||
}, | ||
"devDependencies": { | ||
"mocha": "~1", | ||
"request": "~2" | ||
"mocha": "~1" | ||
}, | ||
@@ -20,0 +20,0 @@ "keywords": [ |
@@ -12,3 +12,3 @@ "use strict"; | ||
init: function ( done ) { | ||
httpServer = http.createServer( server ).listen( 8080, done ); | ||
httpServer = server.listen( 8080, done ); | ||
}, | ||
@@ -20,3 +20,3 @@ dinit: function ( done ) { | ||
config: { | ||
express: server, | ||
app: server, | ||
url: '/rpc' | ||
@@ -23,0 +23,0 @@ }, |
"use strict"; | ||
var assert = require( 'assert' ); | ||
var FlingReceiver = require( '../lib/receive' ); | ||
var FlingReceiver = require( '../lib/receiver' ); | ||
var AbstractReceiverTransport = require( '../lib/transport.receiver.abstract' ); | ||
@@ -6,0 +6,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
55456
1
1701
1
4
2
+ Addedbody-parser@~1.0
+ Addedaccepts@1.1.4(transitive)
+ Addedbody-parser@1.0.2(transitive)
+ Addedbytes@1.0.0(transitive)
+ Addedcookie@0.1.2(transitive)
+ Addedcookie-signature@1.0.5(transitive)
+ Addedcrc@3.0.0(transitive)
+ Addeddebug@2.0.0(transitive)
+ Addeddepd@0.4.5(transitive)
+ Addeddestroy@1.0.3(transitive)
+ Addedee-first@1.0.51.1.0(transitive)
+ Addedescape-html@1.0.1(transitive)
+ Addedetag@1.4.0(transitive)
+ Addedexpress@4.9.8(transitive)
+ Addedfinalhandler@0.2.0(transitive)
+ Addedforwarded@0.1.2(transitive)
+ Addedfresh@0.2.4(transitive)
+ Addedipaddr.js@1.0.5(transitive)
+ Addedmedia-typer@0.3.0(transitive)
+ Addedmerge-descriptors@0.0.2(transitive)
+ Addedmethods@1.1.0(transitive)
+ Addedmime-db@1.12.0(transitive)
+ Addedmime-types@2.0.14(transitive)
+ Addedms@0.6.2(transitive)
+ Addednegotiator@0.4.9(transitive)
+ Addedon-finished@2.1.02.1.1(transitive)
+ Addedparseurl@1.3.3(transitive)
+ Addedpath-to-regexp@0.1.3(transitive)
+ Addedproxy-addr@1.0.10(transitive)
+ Addedqs@2.2.4(transitive)
+ Addedrange-parser@1.0.3(transitive)
+ Addedraw-body@1.1.7(transitive)
+ Addedsend@0.9.3(transitive)
+ Addedserve-static@1.6.5(transitive)
+ Addedtype-is@1.1.01.5.7(transitive)
+ Addedutils-merge@1.0.0(transitive)
+ Addedvary@1.0.1(transitive)
- Removedbatch@0.5.0(transitive)
- Removedbuffer-crc32@0.2.1(transitive)
- Removedbytes@0.2.1(transitive)
- Removedcommander@1.3.2(transitive)
- Removedconnect@2.12.0(transitive)
- Removedcookie@0.1.0(transitive)
- Removedcookie-signature@1.0.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@0.8.1(transitive)
- Removedexpress@3.4.8(transitive)
- Removedfresh@0.2.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@0.0.1(transitive)
- Removedkeypress@0.1.0(transitive)
- Removedmerge-descriptors@0.0.1(transitive)
- Removedmethods@0.1.0(transitive)
- Removedmkdirp@0.3.5(transitive)
- Removedmultiparty@2.2.0(transitive)
- Removednegotiator@0.3.0(transitive)
- Removedpause@0.0.1(transitive)
- Removedrange-parser@0.0.4(transitive)
- Removedraw-body@1.1.2(transitive)
- Removedreadable-stream@1.1.14(transitive)
- Removedsend@0.1.4(transitive)
- Removedstream-counter@0.2.0(transitive)
- Removeduid2@0.0.3(transitive)
Updatedexpress@~4.9