![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
A lightweight HTTP framework for Typescript / JS, with zero dependencies
In order to evolve the core library faster support for Express and Koa backends has been dropped. Happy to add back later.
combining routes using withRoutes
no longer combines filters from each routing.
See here for more info
npm install --save http4js
or
yarn add http4js
An example server and client
//define our routes
const routing = routes('GET', ".*", async (req: Req) => {
console.log(req);
return ResOf(Status.OK, 'OK');
})
//add csrf token header to every request and vary gzip to every response
const headerFilter = (handler: HttpHandler) => {
return async (req: Req) => {
const response = await handler(req.withHeader(Headers.X_CSRF_TOKEN, Math.random()))
return response.withHeader(Headers.VARY, "gzip");
}
};
routing
.withFilter(headerFilter)
.asServer() // starts on port 3000 by default
.start();
//make an http request to our server and log the response
HttpClient(ReqOf(Method.GET, "http://localhost:3000/any/path"))
// output
Req {
headers:
{ host: 'localhost:3000',
connection: 'close',
'content-type': 'application/x-www-form-urlencoded',
'x-csrf-token': 0.8369821184747923 },
queries: {},
pathParams: {},
form: {},
method: 'GET',
uri:
Uri {
matches: {},
asNativeNodeRequest:
Url {
...,
protocol: 'http:',
host: 'localhost:3000',
port: '3000',
pathname: '/any/path',
path: '/any/path',
href: 'http://localhost:3000/any/path' } },
body: '' }
I'd be very happy if you'd like to contribute :)
git clone git@github.com:TomShacham/http4js.git && \
cd http4js && \
yarn && \
yarn build && \
yarn test
http4js is a port of http4k.
The concept is called Server as a Function (SaaF).
Early ideas and influence from Daniel Bodart's Utterly Idle
We need our own certs to run an HTTPS server locally.
These Commands get you most of the way, I altered them slightly for this script, that may work for you
./create-ssl-certs.sh
If not, follow these Instructions to create your own certificates in order to run an HTTPS server locally.
Then run
yarn test-ssl
FAQs
A lightweight HTTP toolkit
The npm package http4js receives a total of 343 weekly downloads. As such, http4js popularity was classified as not popular.
We found that http4js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.