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.
@btakita/serverless-http
Advanced tools
Use existing web application frameworks in serverless environments
The 2.0 release moves to async/await and requires Node 8+.
All frameworks have been updated to their latest versions.
This module allows you to 'wrap' your API for serverless use. No HTTP server, no ports or sockets. Just your code in the same execution pipeline you are already familiar with.
(* Experimental)
Please check the examples
folder!
const serverless = require('serverless-http');
const Koa = require('koa'); // or any supported framework
const app = new Koa();
app.use(/* register your middleware as normal */);
// this is it!
module.exports.handler = serverless(app);
// or as a promise
const handler = serverless(app);
module.exports.handler = async (event, context) => {
// you can do other things here
const result = await handler(event, context);
// and here
return result;
};
json-server-less-λ - using serverless-http with json-server and serverless framework in AWS
Your code is running in a serverless environment. You cannot rely on your server being 'up' in the sense that you can/should not use in-memory sessions, web sockets, etc. You are also subject to provider specific restrictions on request/response size, duration, etc.
Think of this as a familiar way of expressing your app logic, not trying to make serverless do something it cannot.
Pull requests are welcome! Especially test scenarios for different situations and configurations.
Here are some more detailed examples and advanced configuration options as well as provider-specific documentation
FAQs
Use existing web application frameworks in serverless environments
The npm package @btakita/serverless-http receives a total of 0 weekly downloads. As such, @btakita/serverless-http popularity was classified as not popular.
We found that @btakita/serverless-http 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.