First App
Create, run, and compile your first Tish application.
Create a Tish file
Create main.tish:
fn greet(name) {
return `Hello, ${name}!`
}
console.log(greet("World"))Run with the interpreter
tish run main.tishOutput: Hello, World!
To try code interactively with multi-line input, tab completion, and history, use the Interactive REPL: run tish with no arguments.
Compile to native binary
tish compile main.tish -o hello
./helloSame output. The compiled binary has no runtime dependency on Tish.
For backend options (Rust vs Cranelift), see Native Backend. For WebAssembly (browser or Wasmtime), see WASM Targets.
HTTP server (requires http feature)
Create server.tish:
fn handleRequest(req) {
return { status: 200, body: `Hello, ${req.path}` }
}
serve(8080, handleRequest)Run (the tish binary must be built with the http feature):
cargo run -p tish --features http -- run server.tishOr compile to a standalone binary:
tish compile server.tish -o server --feature http
./serverThen visit http://localhost:8080/.
Deploy to Zectre Platform
See Deploy Overview for using zectre and the Zectre Platform.