TipWe are actively developing FastEdge CLI and recommend regularly checking the FastEdge-lib repository for updates and new versions.
Install and set up FastEdge CLI
1. Clone the FastEdge-lib repository. 2. Install Rust by running the following command:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source "$HOME/.cargo/env"
3. In the directory where you cloned the repository, run the following command to initialize and update all submodules: git submodule update --init --recursive -f
4. Build the CLI tool and all required dependencies: cargo build –release
5. Compile and run the binary with the help
flag to view the full list of available CLI commands and parameters: cargo run --bin cli -- --help
Run FastEdge CLI
To run the compiled CLI tool, use the following command:./target/release/fastedge-run http --help
.
Example commands
This section provides some basic examples of how to work with FastEdge CLI. The sample commands use a test application from the FastEdge-examples repository.Run a FastEdge application and print all its headers
Execute the following command:./target/release/fastedge-run http -w ../FastEdge-examples/rust/target/wasm32-wasip1/release/print.wasm –-port 8080
To view the list of all printed headers, run curl http://localhost:8080
Run a FastEdge application with environment variables
Execute the following command:./target/release/fastedge-run http -w ../FastEdge-examples/rust/target/wasm32-wasip1/release/markdown.wasm env BASE=https://raw.githubusercontent.com/G-Core/FastEdge-lib/main --port 8080
After executing the command, you can run the FastEdge application, which will output the contents of the README: http://localhost:8080/README.md
Run an application with sample geo headers
FastEdge CLI can add sample geo headers to your application without using a real IP address:./target/release/fastedge-run http -w ../FastEdge-examples/rust/target/wasm32-wasip1/release/print.wasm –-geo --port 8081
To view the list of sample geo headers, run curl http://localhost:8081
. You should see an output similar to the following: