Skip to content

Super simple RESTful API example in Rust.

License

Notifications You must be signed in to change notification settings

Thewsthews/APi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTful Rust

Build Status

RESTful Rust is straightforward REST API example written in Rust. It shows how to implement and test GET, POST, PUT and DELETE methods with amazing Warp web server framework.

Getting started

To run the project locally:

  1. install rustup by following the instructions
  2. add clippy (collection of lints) and rustfmt (code formatter) by running rustup component add clippy and rustup component add rustfmt accordingly
  3. clone this repository git clone https://github.com/blurbyte/restful-rust.git
  4. to start an API enter project's directory and run cargo run
  5. run tests with cargo test
  6. lint code with cargo clippy and format it with cargo fmt
  7. run cargo build --release command to generate single optimized binary

Dependencies overview

Dependency Description
warp Composable web server framework with powerful filters system
serde Library for serializing and deserializing data structures
chrono Date and time utilities
log + pretty_env_logger Simple logger (by default enabled in debug mode)

Available endpoints

List of API routes with associated REST verbs:

Testing RESTful API

Nowadays there are many great tools which make testing API easy, such as Postman or Insomnia.

Just enter one of the available endpoints with appropriate HTTP method selected:

Testing POST method with Insomnia REST client

And watch a console / terminal for detailed logs:

Terminal logs after each HTTP request

About

Super simple RESTful API example in Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%