A Smithy Typescript service hosted on AWS Lambda.
This repository is divided into three projects:
model
contains the Smithy model for the service.typescript-client
contains the generated TypeScript client generated frommodel
.server
contains the service, written in TypeScript, formodel
.
Before beginning:
- Install
- Set up an AWS account if you do not have one
- Configure your workstation so the CDK can use your account
- After the first checkout, you will need to kick off the initial code generation by running:
cd model ./gradlew build pTML cd ../typescript-client/codegen ./gradlew clean build cd ../../server/codegen ./gradlew clean build cd ../../
- Next, run
yarn install && yarn build
to do the initial build of the entire project. - To deploy the service, run
cd server && yarn cdk deploy
. When complete, the CDK will print out the endpoint URL for your newly deployed service.Note: this step will create resources in your AWS account that may incur charges.
- To test your service, switch to the
typescript-client
directory and useyarn str-length
to call theLength
operation. For example, given an output from the CDK ofhttps://somerandomstring.execute-api.us-west-2.amazonaws.com/prod/
,should print outyarn str-length https://somerandomstring.execute-api.us-west-2.amazonaws.com/prod/ foobar
6
.