Crates.io | script |
lib.rs | script |
version | 0.5.0 |
source | src |
created_at | 2023-12-09 09:35:11.496812 |
updated_at | 2024-09-03 03:05:47.723962 |
description | barebones http scripting |
homepage | |
repository | https://github.com/themackabu/script |
max_upload_size | |
id | 1063585 |
size | 166,667 |
Define routes on runtime and execute scripts associated with each route. The server supports fetching data, for proxy purposes.
// the index route
index {
text(":3\nwelcome to the root")
}
// this is /hello
hello() {
text("Hello World!")
}
// get data from another website, then return as json
tests/fetch() {
json(http::get("https://httpbin.org/json").json())
}
// route placeholders
#[route("/example/{id}")]
example(id) {
text("base: " + id)
}
For more syntax, check out app.routes
# Start the server
script start <filename>
For more commands, check out script --help
Pre-built binaries for Linux, MacOS, and Windows can be found on the releases page.
Install from crates.io using cargo install script
cargo
cargo build --release
/bin/
or /usr/bin/