smithy-rs/examples
Rbatistab 84fbadc857
Fix broken link on example's smithy model (#3725)
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
There's a broken link on the Readme of the example:
https://github.com/smithy-lang/smithy-rs/blob/main/examples/README.md?plain=1#L34

## Description
Fix the link to point to the common-test models instead:
https://github.com/smithy-lang/smithy-rs/blob/main/codegen-core/common-test-models/pokemon.smithy

## Testing
Readme update, no testing

## Checklist
None
----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._

Co-authored-by: Zelda Hessler <zhessler@amazon.com>
2024-07-01 16:02:52 +00:00
..
pokemon-service Rust msrv 1.74 (#3410) 2024-02-16 21:15:48 +00:00
pokemon-service-client-usage Move `Metadata` config bag type into a stable crate (#3325) 2024-01-12 19:11:29 +00:00
pokemon-service-common Create the HTTP `Response` wrapper types (#3148) 2023-11-10 16:56:04 -08:00
pokemon-service-lambda Add `aws-lambda` as a feature to generated server SDK (#3648) 2024-06-20 10:27:28 +00:00
pokemon-service-tls Update server TLS example to showcase how to extract connection information (#3023) 2023-12-19 15:53:37 +00:00
python Add comment before dumping headers in Python server example (#3083) 2023-12-19 15:16:12 +00:00
.gitignore Move examples to root, refactor to workspace, and refactor integration tests (#2481) 2023-03-22 14:00:21 +00:00
BENCHMARKS.md Fix repo org move issues (#3166) 2023-11-10 18:51:04 +00:00
Cargo.toml Move `Metadata` config bag type into a stable crate (#3325) 2024-01-12 19:11:29 +00:00
Makefile Move examples to root, refactor to workspace, and refactor integration tests (#2481) 2023-03-22 14:00:21 +00:00
README.md Fix broken link on example's smithy model (#3725) 2024-07-01 16:02:52 +00:00

README.md

Smithy Rust Server SDK examples

This folder contains:

  • example services showcasing Smithy Rust Server SDK, also known as the Rust service framework,
  • benchmarking tooling

Three server implementations are available:

  • /pokemon-service, a HTTP server demonstrating middleware and extractors.
  • /pokemon-service-tls, a HTTPS server. This server can do its own TLS negotiation, rather than relying on a load balancer.
  • /pokemon-service-lambda, a server that can be deployed onto AWS Lambda.

These servers, and their clients, are generated using smithy-rs. You're invited to benchmark the performance of these servers to see whether smithy-rs might be a suitable choice for implementing your web service.

Pre-requisites

You will need install Java 17 to run the smithy-rs code generator and an installation of Rust, including cargo, to compile the generated code.

(Optional) The Cargo Lambda sub-command for cargo is required to support the AWS Lambda integration.

Building

Since these examples require both the server and client SDK to be code-generated from their model, a Makefile is provided to build and run the service. Just run make to prepare the first build.

Once the example has been built successfully the first time, idiomatic cargo can be used directly.

Make targets:

  • codegen: generates the Pokémon service crates (default)
  • build: compiles the generated client and server
  • clean: deletes build artifacts
  • clippy: lints the code
  • distclean: delete generated code and build artifacts
  • doc-open: builds and opens the rustdoc documentation
  • lambda_invoke: invokes a running server
  • lambda_watch: runs the service on an emulated AWS Lambda environment
  • run: runs the Pokémon service
  • test: runs integration and unit tests

Running services

To run one of the three server implementations locally, provide the appropriate service name to the --bin flag:

cargo run --bin pokemon-service[(-lambda|-tls)]

CLI arguments can be passed to the server binaries by adding them after --. For example, to see a service's help information, use the following:

cargo run --bin <service> -- --help

Testing

The /pokemon-test*/tests folders provide integration tests involving the generated clients.

They can be invoked with cargo test. This will spawn each service in turn and run some integration tests against it. Use -p <package> to filter by package.

More info can be found in the tests folder of each package.

Benchmarking

Servers running locally (see "Running services") can be benchmarked with any load testing tool, such as Artillery or wrk.

Please see BENCHMARKS.md for benchmarking results produced by the smithy-rs team.