MoreiraJorge / rust-axum-tutorial

A simple REST api built in rust with Axum

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rust Axum REST API tutorial

Rust Axum

This is a simple REST API written in Rust using the Axum web framework. All credits goes to Jeremy Chone with his awesome tutorial.

This tutorial is divided into 3 parts:

  • Beginner:
    • First route Hello World
    • Quick Dev Setup
    • Hello Params / Path
    • Static file router
  • Intermediate:
    • Api login
    • Resposne Mapper layer
    • Cookies
    • Model for CRUD operations
    • API routes
  • Advanced:
    • Custom auth middleware
    • Custom extractor (Ctx)
    • Ctx from REST to CRUD model api
    • Optimisations on Ctx middleware
    • Advance error handling (Client vs Server)
    • Logging

Notes

Execute the following command to run the dev test:

cargo watch -q -c -w tests/ -x "test -q quick_dev -- --nocapture"

Execute the following command to run the api:

cargo watch -q -c -w src/ -x run

Also the course code is available here.

About

A simple REST api built in rust with Axum


Languages

Language:Rust 100.0%