Created
October 15, 2021 12:34
-
-
Save ambujraj/3584e1038a016fa929fef293195d381e to your computer and use it in GitHub Desktop.
AWS lambda deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const awsServerlessExpress = require('aws-serverless-express'); | |
const app = require('./app'); | |
const server = awsServerlessExpress.createServer(app) | |
module.exports.universal = (event, context) => awsServerlessExpress.proxy(server, event, context); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const app = require('./app.js'); | |
// Server listen | |
const port = process.env.PORT || 3000; | |
app.listen(port, () => { | |
console.log("Server listening to port: "+port); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: api-gateway-demo | |
provider: | |
name: aws | |
runtime: nodejs14.x | |
stage: production | |
region: ap-south-1 | |
functions: | |
api: | |
handler: lambda.universal | |
events: | |
- http: ANY {proxy+} | |
- http: ANY / |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment