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

fling

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fling - npm Package Compare versions

Comparing version 0.3.3 to 1.0.0

lib/receiver.js

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;
};

23

lib/transport.receiver.express.js

@@ -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 @@

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