Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Udemy

Creating an API server in Rust with Rocket, SeaORM and JWT

via Udemy

Overview

Build your own REST API server with the safety and performance of Rust using Rocket, SeaORM and JWT authentication.

What you'll learn:
  • Create a Rust project
  • Create a REST API server using Rocket
  • Interacting with a database using SeaORM
  • Authenticating APIs using JWT
  • Writing database migrations using SeaORM CLI

In this course, we'll create a RESTAPIserver in Rust to represent a bookstore. This bookstore would allow us to add books and authors.


Using this system, we'll be able to:

  • Create, list, update and delete authors

  • Create, list, update and delete books

  • Associate and disassociate books and authors

  • List all books by a particular author


We'll learn how to:

  • Create a new Rust project using cargo

  • Build and run our Rust project

  • Add crates and enable crate features


We'll learn about basic API concepts such:

  • Routing and HTTPmethods

  • Extracting data from HTTP requests

  • Interacting with the database to query and insert data

  • Creating user accounts

  • Authentication using JWT

  • Creating and using relationships between models to query and list associated data


Along with these concepts, we'll learn how to:

  • Handle incoming (request) and outgoing (response) data in a type safe way

  • Handle CORS

  • Create and run database migrations

  • Create one-to-many database relationships

  • Create entities from database tables


We'll have a bonus lecture at the end to learn how to Dockerize our API server to deploy and run it anywhere.


We'll be using the following crates:

  1. Rocket: a web framework for Rust that makes it simple to write fast, secure web applications without sacrificing flexibility, usability, or type safety.

  2. SeaORM: is a relational ORM to help you build web services in Rust.

  3. jsonwebtoken to create and decode JWTs in a strongly typed way.

  4. serde_json for serializing and deserializing Rust data structures efficiently and generically.


Syllabus

  • Introduction
  • Rocket: The web framework
  • SeaORM: Interacting with the database
  • REST API
  • Working with Rocket
  • Authentication and Sign Up
  • Implementing Controllers
  • Conclusion

Taught by

Afaan Bilal

Reviews

4.5 rating at Udemy based on 38 ratings

Start your review of Creating an API server in Rust with Rocket, SeaORM and JWT

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.