Today, I am going to show you how to create a rest API for executing system commands in your server. Imagine you have moved your database to another server other than your backend server and you want to take control of your database server from your backend API. For that, we have to create a daemon in the database server.

Step 1 — Picking up dependencies

Let’s start by adding a couple of dependencies to our project.

[dependencies]
actix-web = "2.0"
actix-rt = "1.0"
serde = "1.0.114"
simple_logger = "1.6.0"
log = "0.4.8"
pam = "0.7.0"

I’ll give a short intro about these dependencies first and also once we use them. Actix is the framework that we gonna use for our rest API. serde is used for serialization and deserialization purposes. simple_logger and log are used for logging and the last one pam is used for user authentication purposes.

#rust #programming #rustlang #actix #actix-web

How to Build a REST API to Execute System Commands using Actix Rust 
6.65 GEEK