AWS | REST API Typescript Simple

This template demonstrates how to make a simple REST API with Node.js and Typescript running on AWS Lambda and API Gateway using the Serverless Framework v1.

Clone This Example

Step #1 - npm install serverless -g
Step #2 - serverless install -u https://github.com/serverless/examples/tree/master/aws-node-rest-api-typescript-simple -n  aws-node-rest-api-typescript-simple

Serverless Framework Node with Typescript REST API on AWS

This template demonstrates how to make a simple REST API with Node.js and Typescript running on AWS Lambda and API Gateway using the Serverless Framework v1.

This template does not include any kind of persistence (database). For a more advanced example check out the aws-node-rest-api-typescript example which has must RESTful resources and persistence using MongoDB.

Setup

Run this command to initialize a new project in a new working directory.

sls init aws-node-rest-api-typescript

Usage

Deploy

This example is made to work with the Serverless Framework dashboard which includes advanced features like CI/CD, monitoring, metrics, etc.

$ serverless login
$ serverless deploy

To deploy without the dashboard you will need to remove org and app fields from the serverless.yml, and you won’t have to run sls login before deploying.

Invoke the function locally.

serverless invoke local --function hello

Invoke the function

curl https://xxxxxxxxx.execute-api.us-east-1.amazonaws.com/dev/
view on Github

Latest commit b2f54ec on Sep 24, 2017

New to serverless?

To get started, pop open your terminal & run:

npm install serverless -g