No matching definitions.

tourist/app

src/tourist/app.tur

tourist entry point and server lifecycle.

Since: v0.1.0

defn

tourist

(tourist [port : int items : int] :)

start an HTTP server on port with the given routes and middleware.

portTCP port to bind on (IPv4, INADDR_ANY)
itemsmix of Route and Middleware handles from the DSL constructors

:ptr<void> -- server handle; pass to server-stop when done, or NULL on bind/pool failure

(import httpd/server :refer [server-stop])
  (let [srv (tourist 3000
              (use! logger)
              (get! "/hello/:name"
                (fn [req]
                  (text (ok-val (capture req "name"))))))]
    (server-stop srv))

Since: v0.1.0

Internal definitions
__tourist-cons-- allocate a cons cell with the given head and tail.
__tourist-cons-head-- head element of a cons cell.
__tourist-cons-tail-- tail pointer of a cons cell.
__tourist-list-rev-- reverse a cons list using an accumulator.
tourist-state-ptr-- return a pointer to the persistent dispatch state.
__tourist-state-set-- write mws and routes into the dispatch state.
__tourist-state-mws-- read the mws cons list from the dispatch state.
__tourist-state-routes-- read the routes cons list from the dispatch state.
__tourist-collect-mws-- accumulate middleware handles from items (reversed).
__tourist-collect-routes-- accumulate route handles from items (reversed).
__tourist-caps-wildcard-- extract the "*" wildcard value from captures.
__tourist-method-match?-- true if rmethod matches the request method.
__tourist-opt-extract-- unwrap a some(Response) option and free the option.
__tourist-route-dispatch-- find the first matching route and dispatch.
__tourist-handler-- top-level request handler passed to server-start.
__tourist-handler-ptr-- return __tourist-handler as a :ptr<void>.