Smithy-rs PokémonService API

Overview

Smithy-rs PokémonService API

                                              ,'\
                _.----.        ____         ,'  _\   ___    ___     ____
            _,-'       `.     |    |  /`.   \,-'    |   \  /   |   |    \  |`.
            \      __    \    '-.  | /   `.  ___    |    \/    |   '-.   \ |  |
             \.    \ \   |  __  |  |/    ,','_  `.  |          | __  |    \|  |
               \    \/   /,' _`.|      ,' / / / /   |          ,' _`.|     |  |
                \     ,-'/  /   \    ,'   | \/ / ,`.|         /  /   \  |     |
                 \    \ |   \_/  |   `-.  \    `'  /|  |    ||   \_/  | |\    |
                  \    \ \      /       `-.`.___,-' |  |\  /| \      /  | |   |
                   \    \ `.__,'|  |`-._    `|      |__| \/ |  `.__,'|  | |   |
                    \_.-'       |__|    `-._ |              '-.|     '-.| |   |
                                            `'                            '-._|

Gotta catch 'em all!

Package showing how you can build an API using smithy-rs

How to build

This package requires an initial build using Gradle to generate the Cargo workspace:

❯❯❯ ./gradlew assemble

After the first build any change to the model will be detected by Cargo and the code-generator should run automatically.

❯❯❯ cargo build
❯❯❯ cargo run
❯❯❯ cargo test

If the SDKs are not getting update after a model change, you can manually trigger it:

❯❯❯ ./gradlew clean && ./gradlew assemble

Run and test

There are end-to-end unit tests that can be run with

❯❯❯ cargo test

To run and test the service manually:

❯❯❯ RUST_LOG=aws_smithy_http_server=debug,pokemon_service=debug cargo run
❯❯❯ curl -k -H "Accept: application/json" https://localhost:13734/pokemon-species/pikachu |jq

Build my own project

Gradle and Smithy can be intimidating and Smithy-rs is not jet released on Maven. For this reason, this repository provides a script that can be used to provision a new project: the script generates all the necessary Gradle scaffolding and provides code-generation using a GIT sub-module.

❯❯❯ ./docs/template/new.sh service-crate-name destination-directory

For example this command

❯❯❯ ./docs/template/new.sh pokemon-service /tmp/pokemon-service

will generate a new Gradle project inside /tmp/pokemon-service, a Cargo workspace with 3 crates, pokemon-service, the business logic, pokemon-service-server-sdk, the server Smithy-rs SDK for the server (code-generated) and pokemon-service-client-sdk, the client Smithy-rs SDK (code-generated).

The repo will only generate the SDKs for client and server for the very simple model that can be found here. This is done by providing a smithy-build.json.

Once this command has succeeded, you can use these commands in the new repo:

❯❯❯ ./gradlew clean && ./gradlew assemble   # regenerate after a model change.
❯❯❯ cargo build                             # build the workspace.
❯❯❯ cargo run                               # run the service.
❯❯❯ cargo test                              # test the workspace.

Slides

There are some slides built with Marp in the docs/slides folder that can be viewed by opening the rendered HTML.

Slides can be rebuilt by running:

❯❯❯ cd docs && marp slides.md

Generate a new SSL self-signed CA

❯❯❯ openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 -nodes \
  -keyout certs/localhost.key -out certs/localhost.crt -subj "/CN=localhost" \
  -addext "basicConstraints=critical,CA:false" \
  -addext "subjectAltName=DNS:localhost"
You might also like...
A customizable, simple and easy to use json REST API consumer

JACK is a generic JSON API client. It is useful to interact with APIs from multiple services such as Google and Twitter

Print Apple WeatherKit REST API weather conditions and hourly/daily foreacast to the console.
Print Apple WeatherKit REST API weather conditions and hourly/daily foreacast to the console.

weatherkit-rust A Rust CLI program to print current conditions and daily/hourly forecast to the console. Please read authorization.md as you need an A

Rust Rocket MongoDB token-authorization REST API boilerplate

Rust Rocket MongoDB token-auth REST API boilerplate In this repository, you can find backend Rust rocket mongodb rest-api boilerplate with token autho

RESTful Todo API with Actix-web and SeaORM. Documented by swagger-ui

RESTful Todo RESTful Todo API with Actix and SeaORM. Documented by swagger-ui Prerequisites Rust Usage Clone the repository and run the following comm

An API to track various stats written in Rust. Tracking Github, Wakatime, Spotify, and Duolingo
An API to track various stats written in Rust. Tracking Github, Wakatime, Spotify, and Duolingo

Null API API For collecting data Explore the docs » View Demo · Report Bug · Request Feature Table of Contents About The Project Built With Getting St

OpenAI's ChatGPT API wrapper for Rust 🦀
OpenAI's ChatGPT API wrapper for Rust 🦀

Regarding API changes from December 11th 2022 OpenAI made a change to API, and now requires a cloudflare clearance token. Due to this, authentication

Real-time bidding API scaffold for MevWallet transactions

MevWallet RTB API This repo provides a standard interface for a real-time bidding API. Searchers run the API to provide bids to users. The bid represe

Rust HTTP API Template using PostgreSQL, Redis, RabbitMQ, and Hexagonal Architecture

Rust Template HTTP API Rust API Template using PostgreSQL, Redis, RabbitMQ, and Hexagonal Architecture The following template provides a basic structu

This is a simple Api template for Rust ( Axum framework )

Axum-Rust-Rest-Api-Template This project is an open source Rest Api Template built with Rust's Axum framework. Why this project? I have been learning

Owner
Matteo Bigoi
Rust Service Frameworks builder at @awslabs
Matteo Bigoi
A secure and efficient gateway for interacting with OpenAI's API, featuring load balancing, user request handling without individual API keys, and global access control.

OpenAI Hub OpenAI Hub is a comprehensive and robust tool designed to streamline and enhance your interaction with OpenAI's API. It features an innovat

Akase Cho 30 Jun 16, 2023
Grape is a REST-like API framework for Ruby

Grape is a REST-like API framework for Ruby. It's designed to run on Rack or complement existing web application frameworks such as Rails and Sinatra by providing a simple DSL to easily develop RESTful APIs. It has built-in support for common conventions, including multiple formats, subdomain/prefix restriction, content negotiation, versioning and much more.

Ruby Grape 9.7k Jan 2, 2023
Rust implementation of the `URLPattern` web API

urlpattern This crate implements the URLPattern web API in Rust. We aim to follow the specification as closely as possible. Contributing We appreciate

Deno Land 40 Dec 14, 2022
A pure Rust implementation of the Web Local Storage API, for use in non-browser contexts

Rust Web Local Storage API A Rust implementation of the Web LocalStorage API, for use in non-browser contexts About the Web Local Storage API MDN docs

RICHΛRD ΛNΛYΛ 10 Nov 28, 2022
An tiny web API for @QuarryProtocol

Warlock Warlock is a tiny web API layer around Quarry Protocol and has endpoints to deserialize Quarry accounts like quarries, miners, and rewarders t

Rohan Kapur 2 May 16, 2022
Scratch-Containerised Rust GraphQL-API using Dataloaders

Dockerize Graphql Rust More current version at https://github.com/jayy-lmao/rust-cult-graphql-server This project is currently for demonstrating the u

James H. 89 Dec 3, 2022
A Rust Boilerplate server with GraphQL API, Diesel, PostgreSQL, session authentication and JWT

Canduma rust Graphql A Rust authentication server with GraphQL API, Diesel, PostgreSQL session authentication and JWT This repository contains a Graph

Julien Lenne 738 Dec 28, 2022
Implementation of the RealWorld backend API spec in Actix, Rust's powerful actor system and most fun web framework.

Actix codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API. ❗ (2021/05/13) This cod

Allen 475 Jan 2, 2023
Rust Rest API Stack with User Management

A secure-by-default rest api stack implemented with hyper, tokio, bb8 and postgres. This project is focused on providing end-to-end encryption by default for 12-factor applications. Includes a working user management and authentication backend written in postgresql with async S3 uploading for POST-ed data files.

Jay 10 Dec 25, 2022
Fastest autocomplete API written in rust 🦀

rust-autocomplete-api fastest* autocomplete API written in rust ?? *probably Run it locally cargo build --release ./target/release/autocomplete-api-po

Alexander Osipenko 4 Sep 23, 2022