
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
In this world of internet of things, we have realized that while there are multiple frameworks, protocols and standards that allow you to intercommunicate between different devices none is more prevalent than the actual ones exposed by and defined through the web. For this reason, this module has the intent of standardizing using HTTP, REST and web sockets with the intent to facilitate connecting logic and data while maintaining its distribution and facilities.
httphooks
is a node HTTP pub-sub architecture that allows you to associate an incoming HTTP request to a single/multiple dependent/independent user defined operations. These operations work in a loosely coupled manner such that together, with a well defined execution model, each collaborate in order to deliver a result. httphooks
extends the webhooks model to the primary REST HTTP verbs and formalizes request/response, inter-communication and signaling using HTTP as the communication standard.
While there are existing and similar modules (a.k.a middleware), we have a pretty interesting architecture, model and set of features that are not present in others and which allow you to streamline your development. Don't be shy and take a look at our documentation, you just might be pleasantly surprised...
npm install httphooks
The test suite can be invoked from the command line like this:
npm test
In order to successfully run the tests three environment variables are used for setting the port numbers: PORT
, PORT1
and PORT2
.
PORT
and PORT1
default to 8080
PORT2
defaults to 8081
For now, if you want to use different port numbers, you'll have to modify the values in the ./tests/runTests.js
file. When time permits we'll change this so it can be done in some other manner (i.e. via a JSON file, command-line options, etc.).
With httphooks
you are able to associate logical units for execution with url paths with a given HTTP verb.
var http = require('http');
var HttpHooks = new require('httphooks');
var hooks = new HttpHooks();
// Respond to any incoming requests with a hello world message which includes the url path
hooks.get('/*', function (hookContext, done) {
var request = hookContext.request;
var response = hookContext.response;
hookContext.setResponse(
200,
{ 'Content-Type': 'text/html' },
'Welcome to \'' + request.url.path + '\'... Hello World! :)');
done();
});
var server = http.createServer(function (request, response) {
hooks.dispatch({request: request, response: response});
});
server.listen(8080);
FAQs
A webhook implementation which extends the concept to HTTP REST API's
The npm package httphooks receives a total of 2 weekly downloads. As such, httphooks popularity was classified as not popular.
We found that httphooks 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.