
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
service-host
Advanced tools
npm install service-host
# Start up a service host
node bin/start.js --config path/to/config.js
Config files should export an object.
var Host = require('service-host');
var host = new Host({
debug: true,
port: 9000,
});
host.addService({
name: 'foo',
handler: function(data, done) {
// ...
if (someError) {
done(someError);
} else {
done(null, output);
}
}
});
// Call a service
host.callService(
// The name of the service to call
'foo',
// An optional data set to pass to the service
{},
// An optional cache key to cache the output of the service
'some-cache-key',
// A callback which is provided with the resulting error and output
function(err, output) {}
);
// Start a process which listens at the configured
// address and port
host.listen();
X-Service: the name of the service that you want to call.X-Cache-Key: a token used to cache the output of the request,
all concurrent or subsequent requests will resolve to the same
output until it expires.Set the request's content-type to application/json and pass the data in
as the request's body. It will be deserialised and passed to the service.
// Default config
var host = new Host({
// The address that the host will listen at
address: '127.0.0.1',
// The port that the host will listen at
port: '63578',
// If true, suppresses stdout/stderr from the host and service loggers
silent: false,
// If true, the host will write to stdout once it is listening for requests
outputOnListen: true,
// The maximum size of an incoming request's body
requestDataLimit: '10mb',
// The time between a cache key/value being set and its expiry
serviceCacheTimeout: 24 * 60 * 60 * 1000, // 24 hours
// An optional array of services to load during the host's initialization.
// Services should be objects with `name` and either `file` or `handler`
// properties. The `file` prop should be a path to a file which exports a
// handler function.
services: null
});
FAQs
JS service host
We found that service-host 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.