Skip to content

stormfiber/rust_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust API

Template For Building Rest APIs With Rust

Rust Actix Web License

Getting Started

git clone https://github.com/stormfiber/rust_api
cd rust_api

Build and Run

cargo build
cargo run

Test Routes

  • Shorten a URL (POST)
curl -X POST http://127.0.0.1:3000/url/shorten \
     -H "Content-Type: application/json" \
     -d '{"url": "https://example.com"}'
  • Response Example:
{
  "short_url": "s19"
}
  • Expand a short URL (GET)
http://127.0.0.1:3000/url/expand?short=s19
  • Response Example:
{
  "url": "https://example.com"
}
  • GET QR as PNG Browser
http://127.0.0.1:3000/qr/generate_png?message=HelloWorld
  • POST QR as Base64 JSON
curl -X POST http://127.0.0.1:3000/qr/generate_base64 \
     -H "Content-Type: application/json" \
     -d '{"message": "HelloWorld"}'
  • Response Example:
{
  "message": "HelloWorld",
  "qr_base64": "iVBORw0KGgoAAAANSUhEUgAA..."
}

About

Template For Building Rest APIs With Rust

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages