rust-rocket-sample

Fully working CRUD REST API example using Rust and Rocket.rs

MIT License

Stars
53
Committers
2

Bot releases are visible (Hide)

rust-rocket-sample - v1.3.0 Latest Release

Published by TaeyoonKwon over 2 years ago

🔧 Technical Updates

  • add github folder into .dockerignore
  • version up rocket from 0.5.0-rc.1 to 0.5.0-rc.2
  • version up rocket_okapi from 0.8.0-rc.1 to 0.8.0-rc.2
rust-rocket-sample - v1.2.0

Published by TaeyoonKwon over 2 years ago

🔧 Technical Updates

  • [staging] option at Rocket.toml is removed because it is deprecated in rocket 0.5.0
  • add proper env variables at ci.yaml to run tests with proper environment variables.
rust-rocket-sample - v1.1.0

Published by TaeyoonKwon over 2 years ago

🔧 Technical Updates

  • Github Action's CI workdflow added.
rust-rocket-sample - v1.0.0

Published by TaeyoonKwon over 2 years ago

🚀 Features

Database

  • Initialize MongoDB connection using Rocket's Adhoc fairing.

Error Handling

  • custom struct MyError for handling errors in api responses.

Fairing

  • simple fairing Counter to demonstrate how fairing works.

Model

  • Customer model including CustomerDocument for MongoDB Document and CustomerInput for post requests.

Request Guard

  • ApiKey request guard for commonly used x-api-key pattern

API

  • (GET)/customer to get a list of CustomerDocument
  • (GET)/customer/{_id} to get a single CustomerDocument by ObjectId
  • (POST)/customer/ to create a CustomerDocument
  • (PATCH)/customer/{_id} to update a single CustomerDocument by ObjectId
  • (DELETE)/customer/{_id} to delete a single CustomerDocument by ObjectId