A step-by-step tutorial for building a scalable Rust HTTP server using Actix and MongoDB.
⏰ Timestamps
00:00 - Intro
00:47 - Creating the project
01:14 - Installing dependencies
01:46 - Setting up main.rs
04:10 - Running the project
04:51 - Building the models
16:27 - Building the database service
33:14 - Building the routes
40:57 - Testing the routes in Postman
43:11 - Outro
📜 Description
In this tutorial, you'll learn how to build a simple HTTP web server in Rust, with the following endpoints:
• POST /owner — for adding an owner.
• POST /dog — for adding a dog to the given owner.
• POST /booking — for adding a booking for the given owner.
• GET /bookings — to get all the future bookings, from closest in time to furthest away.
• PUT /booking/{id}/cancel — to cancel a particular booking that’s fallen through.
#rust #actix #mongodb #api #server
💻 Code
To see the final project, go to: https://github.com/BretCameron/rust-web-server-tutorial.
📝 Article
For a written version of this tutorial, check out my article:
https://www.bretcameron.com/blog/how-to-build-an-api-server-with-rust
🔗 Links
• Rust: https://www.rust-lang.org/tools/install
• Actix Web: https://actix.rs/docs/
• MongoDB: https://mongodb.com/docs/manual/tutorial/getting-started/