aws-serverless-express

Run serverless applications and REST APIs using your existing Node.js application framework, on top of AWS Lambda and Amazon API Gateway

Github星跟蹤圖

AWS Serverless Express

Join the chat at https://gitter.im/awslabs/aws-serverless-express
Build Status npm npm dependencies Status devDependencies Status

Run serverless applications and REST APIs using your existing Node.js application framework, on top of AWS Lambda and Amazon API Gateway. The sample provided allows you to easily build serverless web applications/services and RESTful APIs using the Express framework.

Getting Started

npm install aws-serverless-express
// lambda.js
'use strict'
const awsServerlessExpress = require('aws-serverless-express')
const app = require('./app')
const server = awsServerlessExpress.createServer(app)

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

Package and create your Lambda function, then configure a simple proxy API using Amazon API Gateway and integrate it with your Lambda function.

Quick Start/Example

Want to get up and running quickly? Check out our basic starter example which includes:

Getting the API Gateway event object

This package includes middleware to easily get the event object Lambda receives from API Gateway

const awsServerlessExpressMiddleware = require('aws-serverless-express/middleware')
app.use(awsServerlessExpressMiddleware.eventContext())
app.get('/', (req, res) => {
  res.json(req.apiGateway.event)
})

Is AWS serverless right for my app?

Benefits

Considerations

  • For apps that may not see traffic for several minutes at a time, you could see cold starts
  • Cannot use native libraries (aka Addons) unless you package your app on an EC2 machine running Amazon Linux
  • Stateless only
  • API Gateway has a timeout of 29 seconds, and Lambda has a maximum execution time of 15 minutes.

主要指標

概覽
名稱與所有者CodeGenieApp/serverless-express
主編程語言JavaScript
編程語言JavaScript (語言數: 3)
平台
許可證Apache License 2.0
所有者活动
創建於2016-09-13 23:29:07
推送於2024-10-24 21:46:15
最后一次提交2020-12-31 20:12:53
發布數94
最新版本名稱v4.16.0 (發布於 )
第一版名稱v1.3.0 (發布於 2017-01-24 09:46:33)
用户参与
星數5.2k
關注者數101
派生數671
提交數526
已啟用問題?
問題數367
打開的問題數90
拉請求數173
打開的拉請求數6
關閉的拉請求數149
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?