script

Crates.ioscript
lib.rsscript
version0.5.0
sourcesrc
created_at2023-12-09 09:35:11.496812
updated_at2024-09-03 03:05:47.723962
descriptionbarebones http scripting
homepage
repositoryhttps://github.com/themackabu/script
max_upload_size
id1063585
size166,667
Mack (theMackabu)

documentation

README

barebones http scripting

Overview

Define routes on runtime and execute scripts associated with each route. The server supports fetching data, for proxy purposes.

Usage

// 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

Installation

Pre-built binaries for Linux, MacOS, and Windows can be found on the releases page.

Install from crates.io using cargo install script

Building

  • Clone the project
  • Open a terminal in the project folder
  • Check if you have cargo (Rust's package manager) installed, just type in cargo
  • If cargo is installed, run cargo build --release
  • Put the executable into one of your PATH entries, usually /bin/ or /usr/bin/
Commit count: 0

cargo fmt