Skip to content

tranlehaiquan/realworld-lambda

Repository files navigation

Serverless Framework Node with Typescript HTTP API on AWS

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

This template does not include any kind of persistence (database). For more advanced examples, check out the serverless/examples repository which includes Typescript, Mongo, DynamoDB and other examples.

Setup

Code Base

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

yarn install

Install Serverless Framework

npm install -g serverless

Create database

https://docs.aws.amazon.com/lambda/latest/dg/services-rds-tutorial.html#w122aac77d191c13c31

After create database note down:

  • region
  • vpc security group
  • vpc subnet
  • Endpoint

Update serverless.yml

Update serverless.yml with the noted above after create database

provider:
  stage: development
  region: ap-southeast-1
  vpc:
    securityGroupIds:
      - sg-088a45d7f13efc1b2
    subnetIds:
      - subnet-0b3fcbbf1d9434338
      - subnet-047066056a5270ad8
      - subnet-06922adb28d6b894d

Update params in Serverless Dashboard

DB_USERNAME
DB_PASSWORD
DB_PORT
jwt
DB_DATABASE
DB_HOST

serverless params

Update src/data-source.ts with the noted above after create database

Deploy

yarn deploy

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published