Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
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: {
pageSize: t.union([t.undefined, t.number]),
pageNumber: t.union([t.undefined, t.number])
},
pathParameters: {
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 0 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.