File tree 5 files changed +64
-0
lines changed
5 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 33
33
## Proxy API
34
34
35
35
* [ Deploying a Proxy API] ( deploy-proxy-api ) &ndash ; an example of how to create an API Gateway that will proxy all requests directly to a Lambda function
36
+ * [ Running Express Apps in AWS Lambda] ( express-app-lambda ) &ndash ; an example of how to deploy an existing Express app with minimal changes to Lambda
36
37
37
38
## Chat-bots
38
39
Original file line number Diff line number Diff line change
1
+ # Running Express apps in AWS Lambda
2
+
3
+ This is a simple example that shows how to deploy an existing [ Express] ( http://expressjs.com/ ) application, with minimal changes, to AWS Lambda.
4
+
5
+ ## Running the example
6
+
7
+ 1 . run ` npm install ` to grab the dependencies
8
+ 2 . run ` npm run generate-proxy ` to create a simple proxy API for the express app
9
+ 3 . run ` npm run deploy ` to send everything up to AWS Lambda
10
+
11
+ The third step will print out a URL you can use to access the express app.
12
+
13
+ ## Updating the app
14
+
15
+ 1 . Change [ ` app.js ` ] ( app.js )
16
+ 2 . (Optionally) use ` npm install <PACKAGE NAME> -S ` to install additional dependencies (always save them to ` package.json ` using ` -S ` )
17
+ 3 . Run ` npm run update ` to send the new version up to AWS. No need to generate the proxy again
18
+
19
+ ## More information and limitations
20
+
21
+ See the [ Running Express Apps in AWS Lambda] ( https://claudiajs.com/tutorials/serverless-express.html ) tutorial.
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+ const express = require ( 'express' )
3
+ const app = express ( )
4
+
5
+ app . get ( '/' , ( req , res ) => {
6
+ res . sendFile ( `${ __dirname } /index.html` )
7
+ } )
8
+
9
+ // app.listen(3000) // <-- comment this line out from your app
10
+
11
+ module . exports = app // export your app so aws-serverless-express can use it
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < title > Serverless Express Example</ title >
5
+ </ head >
6
+ < body >
7
+ < h1 > Hello from Express</ h1 >
8
+ < p > this page is served by Express, through
9
+ < a href ="https://www.npmjs.com/package/aws-serverless-express "> aws-serverless-express</ a > and
10
+ < a href ="https://claudiajs.com/tutorials/deploying-proxy-api.html "> Claudia.JS Proxy API</ a > </ p >
11
+ </ body >
12
+ </ html >
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " claudia-express" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " Example application for running a Node Express app on AWS Lambda using Amazon API Gateway." ,
5
+ "main" : " lambda.js" ,
6
+ "scripts" : {
7
+ "deploy" : " claudia create --handler lambda.handler --deploy-proxy-api --region us-east-1" ,
8
+ "update" : " claudia update" ,
9
+ "generate-proxy" : " claudia generate-serverless-express-proxy --express-module app"
10
+ },
11
+ "license" : " Apache-2.0" ,
12
+ "dependencies" : {
13
+ "aws-serverless-express" : " ^1.1.0" ,
14
+ "express" : " ^4.14.0"
15
+ },
16
+ "devDependencies" : {
17
+ "claudia" : " ^2.1.0"
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments