JavaScript Minifier Rust Example

Check the example on how to use
Rust
to minify a JavaScript hardcoded string and output to stdout:
use reqwest::blocking::Client;

fn main() {
    let client = reqwest::blocking::Client::new();
    let resp = client.post("https://www.toptal.com/developers/javascript-minifier/api/raw")
        .form(&[("input", "console.log(  1  )")])
        .send().unwrap()
        .text().unwrap();
    println!("response = {:?}", resp);
}
Install
reqwest
crate, save the code to a file named
minify.rs
and run the following command:
rustc minify.rs

Output:

console.log(1)