serve

The web framework: an HTTP/1.1 keep-alive server core, a router with :param captures, and Handler/Middleware structural interfaces.

Install

Add it to your wo.toml. The KEY is the module name — that is what use imports.

[deps]
serve = { git = "https://github.com/shoneyj/writeonce-serve", rev = "v0.1.0" }

What you get

Usage

use serve
use serve/http
use serve/router

class Hello {
  fn handle(req: Req) -> Resp {
    return ok_text("hello");
  }
}

fn main(args: multi Text) -> Int {
  let app = App { middleware: [], routes: [] };
  app.use_mw(Mw { m: Logging {} });
  app.get("/", Hello {});
  return app.serve("127.0.0.1", 8080);
}

← all packages