Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Isomorphic call API or RPC as Promise for any nodejs/express application.
Server
npm install iso-call
Client
Use browserify + aliasify to bundle your application and iso-call for browser:
npm install browserify aliasify --save-dev
Add these into your package.json
to enable aliasify:
"browserify": {
"transform": ["aliasify"]
}
You may also use do more tricks with proper aliasify settings:
(TODO: add examples for these use case)
1. Enable Required ES Features
You should enable Promise and Object.assign() before using iso-call
in your application for both server and client.
// A. BABEL way: Init ES6 environments for require()
require('babel/register')();
// B. polyfill way: auto polyfill Promise and Object.assign()
require('object.assign').shim();
require('es6-promise').polyfill();
2. Setup your API
You should setup all your API or RPC list only for server.
isocall = require('iso-call');
// Setup your API or RPC
isocall.addConfigs({
// API as {name: endpoint} list
yql: 'http://https://query.yahooapis.com/v1/public/yql',
graph: 'https://graph.facebook.com/v2.3/641060562',
// RPC as {name: function} list
connectdb: function (params) {
return mysqlPromise(params.host, params.port);
}
});
3. Setup middleware
You should setup middleware for express only at server side to wrap client side iso-call
.
var express = require('express');
var app = express();
isocall.setupMiddleware(app);
4. Call API or RPC!
Now you can do isomprphic RPC!!
// Works on both client and server side!
isocall.execute('rpcName', rpcParams).then(function (R) {
// Success, R = result
}).catch(function (E) {
// Failed , E = error
});
Or make isomorphic http request!!
// Works on both client and server side!
isocall.request('apiName', requestParams).then(function (R) {
// Success, R = {error: ... , response: ... , body: ...}
}).catch(function (R) {
// Failed , R = {error: ... , response: ... , body: ...}
});
Check our shell example to know more about isocall.execute().
Check our YQL example to know more about isocall.request().
FAQs
Isomorphic api call for any nodejs/express application
The npm package iso-call receives a total of 2 weekly downloads. As such, iso-call popularity was classified as not popular.
We found that iso-call demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.