afBedSheetDraftUser Guide
Overview
BedSheetDraft is a library for integrating draft with afBedSheet.
With BedSheetDraft you can:
Configuration
Simply add afBedSheetDraft and draft as project dependencies in your build.fan...
depends = ["sys 1.0", "afIoc 1.3", "afBedSheet 1.0", "draft 1.0", ... ]
...and thats it!
Because BedSheetDraft defines pod meta-data for afIoc, no more configuration or setup is required.
Draft Routing
Draft Routes match request URIs and call request handlers with a single map of arguments. Contribute draft routes the same way you would with afBedSheet routes:
using draft::Route as DraftRoute
...
@Contribute { serviceType=Routes# }
static Void contributeRoutes(OrderedConfig conf) {
conf.add(DraftRoute("/", "GET", PageHandler#index))
conf.add(DraftRoute("/echo/{name}/{age}", "GET", PageHandler#print))
}
Draft Flash
The Draft Flash is contributed as a threaded service and may be accessed as such:
@Inject private Flash flash
Note that Flash is not a const class so it may not be injected into const services. Instead create a flash method that accesses the afIoc registry:
using afIoc
using draft::Flash as DraftFlash
class ThreadedHandler {
@Inject
private Registry registry
new make(|This|in) { in(this) }
DraftFlash flash() {
registry.dependencyByType(DraftFlash#)
}
}
Release Notes
v1.0.0
- New: Initial release