strips-finance / token-api

0 stars 1 forks source link

Strips API

API methods using AWS lambda and serverless framework

First install serverless globally

yarn global add serverless

Create the new API template with sls

mkdir api_folder
cd api_folder
sls create --template aws-nodejs
yarn

Migrate to typescript

mv handler.js handler.ts
yarn add --dev @types/node @types/aws-lambda @types/jest typescript serverless serverless-offline serverless-plugin-typescript serverless-dotenv-plugin jest ts-jest

copy tsconfig from template folder

cp ../template/tsconfig.json ./

Write handler and launch your app locally

sls offline start

Once ready deploy to AWS

cat ~/.aws/credentials
sls deploy