/todddo-openapi-rs

Survey of the Rust web scene in mid-2019, covering async/await, DDD-esque structure, testing, mocking, OpenAPI, and Actix

Primary LanguageRust

todddo-openapi-rs Build Status codecov

This project explores using using Rust in a DDD-esque fashion (cleanly separated domain and infra), along with the current (as of writing) Rust web tools, such as actix-web, and generated-from-source OpenAPI spec.

In specific:

  • actix-web
  • Mixing Future 0.1 with async/await-ready Future 0.3
  • Using async/await via nightly
  • Using paperclip to generate OpenAPI from source
  • Using future_locks for async mutexes
  • Compiling static assets into the binary.
  • DDD-esque project structuring using workspaces to keep dependencies pure
  • Postponing of concrete types for interfaces (traits) to maximise testability

This is spiritually the sister project to the Go version.

Running

This project requires nightly, so you'll need to rustup toolchain install nightly, then run via

cargo +nightly run

After that, go to http://localhost:8080/swagger/index.html to play around with the built-in Swagger spec + UI.

Swagger

If, for some reason, nightly is borked, nightly-2019-08-20-x86_64-apple-darwin has been known to work; just install the right toolchain (nightly-2019-08-20-${your-architecture}) and run with that instead.