tsweb

[Index] [Quick Jump] For package maintainers and hackage trustees TsWeb is a binding between the Spock web framework and the Beam database API. It provides convenience functions for running database queries from within Spock actions, a Spock session manager replacement using the Beam API, and type-safe routing including type-checked reverse lookups (URLs are associated with first-class labels which are used for reverse lookup). Most of the functionality of TsWeb (ideally, all of it) is demonstrated in the example program, which lives under the Example directory of the source tree. Have a look there for a working example of TsWeb. TsWeb views run with minimal rights; by default they do not have access to the database nor do they have any user information initialized. A view's type signature enumerates its requirements, and those requirements are granted by the view's routing. For example, a view that needs read-write database access, an admin user, and a route to the index URL might have this type signature: And then the view would be routed as: See the docs for "TsWeb.Routing" and "TsWeb.Routing.Auth" for more details. Have a look at "TsWeb.Db" for documentation on running Beam queries from a Spock context. This is just sugar, but it's pretty nice. A small example: See "TsWeb.Db" for more details. This is pretty much invisible, but use TsWeb.Session.patchConfig on your Spock config to replace the default session manager with the TsWeb one. Lifted directly from the "TsWeb.Session" documentation: TsWeb builds on Spock's reroute library to also add type-checked reverse lookups. There's a pretty complete document on that under "TsWeb.Routing", which I'm simply pasting in here: Then, routing to those views looks like this:


Keywords
library, program, web, Propose Tags , TsWeb.Action, TsWeb.Db, TsWeb.Db.Beam, TsWeb.Routing, TsWeb.Routing.Auth, TsWeb.Routing.Clay, TsWeb.Session, TsWeb.Tables.Session, TsWeb.Tables.Session.Test, TsWeb.Types, TsWeb.Types.Db
License
BSD-3-Clause
Install
cabal install tsweb