Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-serverless-express

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-serverless-express

This library enables you to utilize AWS Lambda and Amazon API Gateway to respond to web and API requests using your existing Node.js application framework.

  • 3.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
150K
increased by1.88%
Maintainers
1
Weekly downloads
 
Created

What is aws-serverless-express?

The aws-serverless-express package allows you to easily run Node.js web applications, such as those built with Express, on AWS Lambda and Amazon API Gateway. It simplifies the process of creating serverless applications by handling the integration between Lambda and API Gateway, allowing you to focus on your application logic.

What are aws-serverless-express's main functionalities?

Create a Serverless Express Application

This feature allows you to create a serverless Express application that can be deployed on AWS Lambda. The code sample demonstrates how to set up a simple Express app with a single route and export a Lambda handler that uses aws-serverless-express to handle incoming requests.

const awsServerlessExpress = require('aws-serverless-express');
const app = require('express')();
const server = awsServerlessExpress.createServer(app);

app.get('/hello', (req, res) => {
  res.send('Hello, world!');
});

exports.handler = (event, context) => awsServerlessExpress.proxy(server, event, context);

Custom Lambda Proxy Integration

This feature allows you to customize the Lambda proxy integration, such as specifying custom binary MIME types. The code sample shows how to create a server with custom binary MIME types and handle requests with a custom route.

const awsServerlessExpress = require('aws-serverless-express');
const app = require('express')();
const server = awsServerlessExpress.createServer(app, null, ['*/*']);

app.get('/custom', (req, res) => {
  res.json({ message: 'Custom integration' });
});

exports.handler = (event, context) => awsServerlessExpress.proxy(server, event, context);

Middleware Support

This feature demonstrates how to use middleware in your serverless Express application. The code sample shows how to log incoming requests using middleware and handle a route that responds with a message.

const awsServerlessExpress = require('aws-serverless-express');
const app = require('express')();
const server = awsServerlessExpress.createServer(app);

app.use((req, res, next) => {
  console.log('Request received');
  next();
});

app.get('/middleware', (req, res) => {
  res.send('Middleware example');
});

exports.handler = (event, context) => awsServerlessExpress.proxy(server, event, context);

Other packages similar to aws-serverless-express

Keywords

FAQs

Package last updated on 01 Feb 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc