Skip to content

Latest commit

 

History

History

02-rest-api

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

2 - Build a REST API

rust_practical_sessions_02

Requirements

What we're going to do

  • Verify that everyone has the correct setup before beginning.
  • Create a project using Cargo.
  • Introduction to dependency management.
  • Write a healh-check endpoint.
  • Write a simple REST API.
  • Usage of the dotenv crate.
  • Usage of middlewares
  • Introduction to the SQLx crate.
  • Introduction to the Tokio Tracing crate.
  • Introduction to actix-web-prom crate
  • Testing
  • Verify that everything works as expected.

What we'll see along the way

  • Cargo basics
  • REST API
  • Dependency management
  • Inmutability by default
  • Option / Result types
  • Error handling
  • Module visibility
  • Traits
  • Async/Await
  • Logging
  • Metrics
  • Distributed tracing
  • Macros
  • Tests with Mockall

Database setup

You'll need docker.

cargo make db-setup
cargo make db-migrate

Postman configuration

In the assets folder you'll find a json file that you can import into your Postman client.

Attributions

Lab image by freepik.com