Module
jinks/server
src/jinks/server.pookaA preview is a reader of generated output. It does not mount the source tree, and its reload client is added to HTTP responses rather than saved in production pages. The transport knows sockets; this module knows pages.
API reference
- classHandle
- classRunning
- classResponse
- functionstart
- functionstart_site
- functionmount
- functionmount_url
- functionstart_mounted
- functionhandler
- functionhandler_at
- functionstop
- functionalive
- functionretarget
- functionretarget_site
- functionretarget_mounted
- functionnotify
- functionnotify_styles
- functionrelative
- functiontext
- functionrespond
- functionrespond_at
- functionunmount
- functionread
- functionmime
- functionclient
class Handle
class Running(
handle: Handle,
port: Int,
output: String,
live: Bool,
mount: String
)
handle: Handle
jinks/server.Handleport: Int
Intoutput: String
Stringlive: Bool
Boolmount: String
String
fn(jinks/server.Handle, Int, String, Bool, String) -> jinks/server.Runningclass Response(status: Int, content_type: String, body: BitArray)
status: Int
Intcontent_type: String
Stringbody: BitArray
BitArray
fn(Int, String, BitArray) -> jinks/server.Responsestart(output: String, host: String, port: Int, live: Bool) -> Result(
Running,
String
)
fn(String, String, Int, Bool) -> Result(jinks/server.Running, String)Port zero asks the OS for a free port, useful for independent server tests.
start_site(
output: String,
host: String,
port: Int,
live: Bool,
base_url: String
) -> Result(Running, String)
fn(String, String, Int, Bool, String) -> Result(jinks/server.Running, String)Preview a base-path deployment at the same path it uses on its static host. The mount is decoded once alongside request paths, never as a file root.
mount(base_url: String) -> Result(String, String)
fn(String) -> Result(String, String)mount_url(mount: String) -> String
fn(String) -> Stringstart_mounted(
output: String,
host: String,
port: Int,
live: Bool,
mount: String
) -> Result(Running, String)
fn(String, String, Int, Bool, String) -> Result(jinks/server.Running, String)handler(output: String, live: Bool) -> fn(String, String, String) -> #(
Int,
String,
BitArray
)
fn(String, Bool) -> fn(String, String, String) -> #(Int, String, BitArray)handler_at(output: String, live: Bool, mount: String) -> fn(
String,
String,
String
) -> #(Int, String, BitArray)
fn(String, Bool, String) -> fn(String, String, String) -> #(Int, String, BitArray)stop(server: Running) -> Result(Nil, String)
fn(jinks/server.Running) -> Result(Nil, String)alive(server: Running) -> Bool
fn(jinks/server.Running) -> Boolretarget(server: Running, output: String) -> Result(Running, String)
fn(jinks/server.Running, String) -> Result(jinks/server.Running, String)Retarget only after a successful build if config.toml changes output-dir.
retarget_site(server: Running, output: String, base_url: String) -> Result(
Running,
String
)
fn(jinks/server.Running, String, String) -> Result(jinks/server.Running, String)retarget_mounted(server: Running, output: String, mount: String) -> Result(
Running,
String
)
fn(jinks/server.Running, String, String) -> Result(jinks/server.Running, String)notify(server: Running, revision: Int, problem: String) -> Result(Nil, String)
fn(jinks/server.Running, Int, String) -> Result(Nil, String)notify_styles(
server: Running,
revision: Int,
problem: String,
styles_only: Bool
) -> Result(Nil, String)
fn(jinks/server.Running, Int, String, Bool) -> Result(Nil, String)CSS-only events may replace stylesheet links. All other edits, missed revisions and failed loads keep the ordinary full-page reload behaviour.
relative(target: String) -> Result(String, String)
fn(String) -> Result(String, String)Decode once, then reject dot segments, backslashes, control characters and hidden files. Query strings never become part of a filename.
text(status: Int, body: String) -> Response
fn(Int, String) -> jinks/server.Responserespond(
output: String,
live: Bool,
method: String,
target: String,
revision: Int
) -> Response
fn(String, Bool, String, String, Int) -> jinks/server.Responserespond_at(
output: String,
live: Bool,
method: String,
target: String,
revision: Int,
mount: String
) -> Response
fn(String, Bool, String, String, Int, String) -> jinks/server.Responseunmount(name: String, mount: String) -> Option(String)
fn(String, String) -> Option(String)A prefix must end at a segment boundary: /blog never matches /blogger.
read(output: String, name: String, live: Bool, revision: Int) -> Result(
Response,
String
)
fn(String, String, Bool, Int) -> Result(jinks/server.Response, String)mime(name: String) -> String
fn(String) -> Stringclient() -> String
fn() -> StringErrors use textContent, so a template diagnostic cannot become browser HTML.