glitr_wisp

Interface for wisp to use Glitr’s typed routes

Package Version Hex Docs

gleam add glitr_wisp
import glitr_wisp
import wisp.{type Request, type Response}

pub fn handle_request(req: Request, ctx: web.Context) -> Response {
  use _req <- web.middleware(req)

  glitr_wisp.for(req)
  |> glitr_wisp.try(todo_routes.get_all(), todo_service.get_all(ctx, _))
  |> glitr_wisp.try(todo_routes.get(), todo_service.get(ctx, _))
  |> glitr_wisp.try(todo_routes.create(), todo_service.create(ctx, _))
  |> glitr_wisp.try(todo_routes.update(), todo_service.update(ctx, _))
  |> glitr_wisp.try(todo_routes.delete(), todo_service.delete(ctx, _))
  |> glitr_wisp.unwrap
}

Further documentation can be found at https://hexdocs.pm/glitr_wisp.

Development

gleam run   # Run the project
gleam test  # Run the tests
Search Document