
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@pagopa/handler-kit-express
Advanced tools
@pagopa/handler-kit-express
adapter for Express
import { expressHandler } from "@pagopa/handler-kit-express";
// Given an Handler
// (from the @pagopa/handler README example)
const GetMovies = H.of((req: H.HttpRequest) =>
pipe(
req.body,
// perform a refinement with io-ts, and returns a ValidationError
// that represents a 422 HTTP response
H.parse(GetMoviesBody),
E.map(({ genre }) => genre),
RTE.fromEither,
RTE.chainTaskEither(getMoviesByGenre),
RTE.map((movies) => ({ items: movies })),
// wrap in a 200 HTTP response, with content-type JSON
RTE.map(H.successJson),
// convert Error instances to problem json (RFC 7808) objects
RTE.orElseW(flow(H.toProblemJson, H.problemJson))
)
);
// instead of wiring manually the dependencies
/*
GetMovies({
input: ...,
inputDecoder: ...,
logger: ...,
movies: ...
})*/
// just use "expressHandler"
const GetMoviesExpress = expressHandler(GetMovies)({
movies,
});
const ConsoleLogger: L.Logger = {
log: (r) => () => console.log(r),
format: L.format.json,
};
// now GetMoviesRoute can be called by the Express runtime
const app = express.default();
app.use(express.json());
// decorate "req" with "log" function
app.use(logger(ConsoleLogger));
// enable HTTP request logging
app.use(access());
app.post("/", GetMoviesExpress);
app.listen(3001, () => {
// eslint-disable-next-line no-console
console.log("Server ready on port 3001");
});
See the unit tests for other examples
FAQs
`@pagopa/handler-kit-express` adapter for `Express`
We found that @pagopa/handler-kit-express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.