
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.
io-ts-serverless-handler
Advanced tools
A simple wrapper for Serverless Framework HTTP handlers to remove the boilerplate of using io-ts codecs to validate and extract request parameters
A simple wrapper for Serverless Framework HTTP handlers to remove the boilerplate of using io-ts codecs to validate and extract request parameters.
Install with npm/yarn:
$ yarn add io-ts-serverless-handler
# or npm i --save io-ts-serverless-handler
Create a file where you configure the wrapper function and export it:
// codec-handler.ts
import { configureWrapper } from "io-ts-serverless-handler";
export const codecHandler = configureWrapper({
// Add optional config here
});
Wrap your handler functions with the wrapper function:
import { codecHandler } from "./codec-handler.ts";
export const getUsers = codecHandler(
{
queryParameters: t.partial({
pageSize: t.number,
pageNumber: t.number
}),
pathParameters: t.type({
userId: t.string
})
},
async ({
queryParameters: { pageSize, pageNumber },
pathParameters: { userId }
}) => {
// At this point, all the parameters have been validated by io-ts
// If a validation error occurred, a 400 would have been returned before this point
return userService.getUser(userId, pageNumber, pageSize);
}
);
FAQs
A simple wrapper for Serverless Framework HTTP handlers to remove the boilerplate of using io-ts codecs to validate and extract request parameters
The npm package io-ts-serverless-handler receives a total of 2 weekly downloads. As such, io-ts-serverless-handler popularity was classified as not popular.
We found that io-ts-serverless-handler 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.