Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
express-fp
Advanced tools
Type safe request handlers for Express. TypeScript compatible.
Below is small example that demonstrates request body and query validation using io-ts and fully typed response construction using express-result-types.
const Query = t.interface({ age: NumberFromString });
const Body = composeTypes(
JSONFromString,
t.interface({
name: t.string,
}),
'Body',
);
const requestHandler = wrap(req =>
req.body
.validate(Body)
.chain(body => req.query.validate(Query).map(query => createTuple(body, query)))
.fold(validationErrorsToBadRequest, ([body, query]) =>
Ok.apply(
new JsValue({
// Here the type checker knows the type of `body`:
// - `body.name` is type `string`
// - `body.age` is type `number`
name: body.name,
age: query.age,
}),
jsValueWriteable,
),
),
);
app.post('/', requestHandler);
// ❯ curl --request POST --silent --header 'Content-Type: application/json' \
// --data '{ "name": 1 }' "localhost:8080/" | jq '.'
// [
// "Expecting string at name but instead got: 1."
// ]
// ❯ curl --request POST --silent --header 'Content-Type: application/json' \
// --data '{ "name": "bob" }' "localhost:8080/?age=foo" | jq '.'
// [
// "Expecting NumberFromString at age but instead got: \"foo\"."
// ]
// ❯ curl --request POST --silent --header 'Content-Type: application/json' \
// --data '{ "name": "bob" }' "localhost:8080/?age=5" | jq '.'
// {
// "name": "bob",
// "age": 5
// }
yarn add express-fp
yarn
npm run compile
npm run lint
FAQs
Type safe request handlers for [Express]. TypeScript compatible.
The npm package express-fp receives a total of 1 weekly downloads. As such, express-fp popularity was classified as not popular.
We found that express-fp 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.