Coder Social home page Coder Social logo

aws-sam-hot-reloading's Introduction

AWS SAM Hot Reloading

This repository contains a blueprint or boilerplate code for getting started with developing and testing an AWS lambda project using locally AWS SAM. The project is using TypeScript, transpiling and bundling your source and modules, aiming to have a hot-reloading functionality. The motivation behind this project is explained in this post.

AWSSamHotReloading-DEMO-ezgif com-optimize

Loom Demo

ℹī¸ Installing

  • Install AWS SAM CLI
  • Install the dependencies by running pnpm

Once set up, make sure that you have Docker running.

đŸ’ģ Getting Started

pnpm build

  • Cleans dist and .aws-sam directory (if either exist)
  • Bundles and minifies your code in outputs to dist

pnpm start:watch

  • Run this in a separate console window to watch for changes in your source code and automatically transpile and bundle your code to dist directory.

pnpm start:dev

  • Creates a local HTTP server in Docker to run your serverless application locally
  • In your browser or any REST API client, a GET request to http://localhost:3000/ping will invoke the lambda.

pnpm test

  • Runs unit tests using Jest and generates coverage report

pnpm test:e2e

  • Runs end-to-end tests using Jest and generates coverage report

đŸ§Ē Running Tests

The tests are written using Jest and there are two type of tests in place: unit and integration.

You can run the unit tests using the following command:

pnpm test For the integration tests you have some minor steps before. First, make your the project is compiled and then start the local server using the following command in the root directory:

pnpm start:test

This will spin the local server using the test environment and a local env.json file. Then, your tests also need a .env file in place with the required environment variables. You can create a .env file and add the required environment variables. Finally, you can run the integration tests using the following command:

pnpm test:e2e

aws-sam-hot-reloading's People

Contributors

wolivera 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.