
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
This is a complete rewrite of the original restify-endpoints project. This will support full auto-documentation as well as being able to be attached to restify, express, or a vanilla http service with a router attached.
var restify = require('restify')
var Endpointer = require('./restify.js')
var endpoints = new Endpointer()
endpoints.addEndpoint({
name: 'test',
description: 'test',
method: 'GET',
path: '/test',
version: '1.0.0',
handler: function(req, res, next) {
console.log('test handler called')
res.send('hi')
return next()
}
})
var server = restify.createServer({
name: 'endpointer',
version: '1.0.0'
});
endpoints.attach(server)
server.listen(8000)
var express = require('express')
var endpoints = new endpoints.EndpointManager()
endpoints.attach(express)
express.listen(8000)
With vanilla node HTTP you'll need a router attached.
var http = require('http')
var router = require('router')()
var endpoints = new endpoints.EndpointManager()
function finalHandler(req, res) { }
var server = http.createServer(function(req, res) {
router(req, res, finalHandler(req, res))
})
endpoints.attach(server)
server.listen(8000)
This is only supported on restify
unless you add a server.on('after')
handler for express
or the vanilla http server. You'd need to emit the after
event AFTER the response has already been sent.
FAQs
Declarative API Endpoint Manager
We found that endpointer 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.