Coder Social home page Coder Social logo

lambda-express-server's Introduction

How to create a serverless express app:

Important thing to know:

  • Make sure you have your index.js file in the root of your projects directory. If this isn't here the Lambda function will throw an error.
  • Make sure you don't use the base route in your express server. HTTP requests to this base route will not be sent to our proxy Lambda.

Example:

Will not work

http://supercoolapigatewayurl.com/stageName

Will work

http://supercoolapigatewayurl.com/stageName/todos

Create Lambda function and API Gateway

  1. First create your lambda function. You can upload this code by selecting the content of directory and compressing it. Lambda allows you to take this zip file and upload it.

image

  1. Now you can create your API Gateway. I used the Rest API for this but I'm sure HTTP API would work as well.

  2. You need to add a resource on your API Gateway on the root path. Be sure to check the boxes for configure as proxy resource and enable API Gateway CORS. Then you need to link this resource to the lambda function that we created earlier.

image

image

  1. Now that we finished creating all of our API Gateway changes we need to go and deploy the API so we can test it.

image

lambda-express-server's People

Contributors

vinibjazevich avatar

Stargazers

Evandro Magalhães avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.