The Rust type system makes clear what data you’re handling and what methods are available to you. Learn how to create a REST API with Rust and warp.

Rust is a lot of folks’ favorite programming language, but it can still be hard to find a project for it or even to get a firm grasp of it. A good way to get started with any language is to build something you will use every day. If your company operates microservices, it’s even easier. Rust is well-suited to replace such a service, and you could rewrite it in a matter of days.

When you first get started with Rust, you’ll need to learn the fundamentals. Once you’re familiar with the syntax and basic concepts, you can start thinking about asynchronous Rust. Most modern languages have a build in runtime that handles async tasks, such as sending off a request or waiting in the background for an answer.

In Rust, you have to choose a runtime that works for you. Libraries usually have their own runtime; if you work on a larger project, you may want to avoid adding multiple runtimes.

Tokio is the most production-used and proven runtime that can handle asynchronous tasks, so chances are high that your future employer already uses it. Your choices are therefore somewhat limited since you may need to choose a library that already has Tokio built in to create your API.

For this tutorial, we’ll use warp. Depending on your previous programming experience, it may take a few days to wrap your head around it. But once you understand warp, it can be quite an elegant tool for building APIs.

#rust #rest #api

How to Create a Rest API with Rust and Warp
18.85 GEEK