Giter Club home page Giter Club logo

hello-serverless-aws-nodejs's Introduction

Hello World - Serverless Framework

Summary

A sample project for the Serverless Framework using AWS and Node.js.

See the Serverless Guide for AWS.

Features

Use the Serverless Framework with AWS to:

  • Create Node.js Lambda Functions implementing CRUD functionality for a single DynamoDB Table
  • Develop locally
  • Implement Unit Tests with Mocks and Spies where appropriate
  • Implement source code style conformity via JavaScript Linter rules
  • Deploy to AWS dev from local
  • Create API Gateway Methods forming a RESTful API for each of the Lambda Functions
  • CORS support on API
  • Use Cognito User Pools to Secure API 1

1 Feature in Future Release

Setup

Languages

  • ES6 JavaScript
  • YAML
  • JSON

Editor

You may use any plain text editor. The recommended editor is Atom with the linter-eslint package for code style rule feedback.

Install

Fork the hello-serverless-aws-nodejs GitHub repository. Clone the project to your local machine.

The following packages must be installed on a development machine:

  • Node 6.11.x
  • npm 3.10.x
  • serverless >=1.23.0 <2.0.0

After installing the dependencies listed above, open a terminal navigate to the project base directory, and run:


npm install

Running

The project uses npm and serverless command line interface (CLI) commands to perform tasks. The following sections describe how to perform the most common activities.

Run Tests

To run the project's unit and integration tests, issue the following command.


npm test

Lint the Source Code

To ensure the source code complies with style rules, run the ESLint linter by issueing the following command.


npm run lint

Note: The ESLint utility integrates with many text editors including Atom. If you use Atom, install the linter and linter-eslint packages to lint code changes in real-time.

Create Custom Domain

Each stage of the project (dev, qa, prod) has a uniquely named custom domain under which the RESTful API is hosted. To create the custom domains in API Gateway, run command for the dev stage below. If you wish, you may run the commands for all stages.


# Development
serverless create_domain

# Test
serverless create_domain --stage qa

# Production
serverless create_domain --stage prod

Deploy to AWS

To create all AWS resources and deploy the application, run the following command. Use the --stage option to deploy to qa or prod.


serverless deploy -v

Note: The -v option is short for --verbose. This optional flag instructs serverless to provide detailed, real-time progress from AWS as the deployment operation is executed.

Cleanup

To remove all AWS resources, run the following command. Use the --stage option to cleanup the qa or prod environments.


serverless remove -v

Technology Stack

Production

Application

Development

Operational

Testing

Linting

hello-serverless-aws-nodejs's People

Contributors

mwarman avatar

Stargazers

 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.