Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aws-samples/smithy-server-generator-typescript-sample
https://github.com/aws-samples/smithy-server-generator-typescript-sample
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/aws-samples/smithy-server-generator-typescript-sample
- Owner: aws-samples
- License: mit-0
- Created: 2022-04-05T17:43:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-29T14:31:25.000Z (over 1 year ago)
- Last Synced: 2024-08-03T17:09:17.465Z (4 months ago)
- Language: TypeScript
- Size: 1.17 MB
- Stars: 17
- Watchers: 6
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-smithy - aws-samples: Typescript Example service - anvil.svg" alt="(official)" title="Smithy Official" height="10px"> - Shows how to write a Typescript lambda service using Smithy and call the service using a generated client (see: [blog post](https://aws.amazon.com/blogs/devops/smithy-server-and-client-generator-for-typescript/)). (Learning resources / Server Code Generators)
README
## Smithy Server Generator for TypeScript Example Service
### Overview
This repository is divided into three projects:
- `model` contains the Smithy model for the service.
- `typescript-client` contains the generated TypeScript client generated from `model`.
- `server` contains the service, written in TypeScript, for `model`.### Building
#### Prerequisites
Before beginning:
- Install
- [JDK](https://aws.amazon.com/corretto/) >= 8
- [NodeJS](https://nodejs.org/en/download/) >= 14
- [AWS CDK CLI](https://docs.aws.amazon.com/cdk/v2/guide/cli.html)
- Enable [corepack](https://nodejs.org/api/corepack.html#enabling-the-feature) by running `corepack enable`
- Set up an [AWS account](https://portal.aws.amazon.com/billing/signup) if you do not have one
- [Configure your workstation](https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html#getting_started_prerequisites)
so the CDK can use your account### Getting started
1. After the first checkout, you will need to kick off the initial code generation and build by running:
```bash
./gradlew build && yarn install && yarn build
```
After this initial build, `yarn build` in the root of the project will regenerate the client and server and recompile
all of the code.
2. To deploy the service, switch to the `server` directory and run `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.
3. To test your service, switch to the `typescript-client` directory and use `yarn str-length` to call the `Length`
operation. For example, given an output from the CDK of
`https://somerandomstring.execute-api.us-west-2.amazonaws.com/prod/`,
```bash
yarn str-length https://somerandomstring.execute-api.us-west-2.amazonaws.com/prod/ foobar
```
should print out `6`.## Security
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
## License
This library is licensed under the MIT-0 License. See the LICENSE file.