Spectre is the general-purpose web application framework for Fantom language.
- higly customizable;
- batteries included: flexible url router, cookies, messages, custom sessions;
- full-featured forms library;
- Mustache templates for presentation layer;
- development server with:
- non-blocking IO cycle for perfect scalability;
- WebSocket protocol draft 76 support;
- instant app reload in dev mode.
Spectre documentation can be found at spectreframework.org/documents/ or in a doc/
folder of Spectre distribution.
using spectre
class HelloWorldApp : Settings {
new make(Str:Obj? params) : super(params) {
routes = Router {
["/*", |->Res| { Res("Hello, world!") }]
}
}
}
For more examples take a look at examples/
folder of Spectre distribution.
You’ll need:
- Fantom 1.0.59;
- Printf;
- Mustache;
- And Spectre of course.
Set up Fantom’s jdkHome
property in $FAN_HOME/etc/build/config.props
. Then run:
>>> fan printf/build.fan
>>> fan mustache/build.fan
>>> fan spectre/src/build.fan
>>> cp $FAN_HOME/lib/fan/printf.pod spectre/lib/fan/
>>> cp $FAN_HOME/lib/fan/mustache.pod spectre/lib/fan/
>>> cp $FAN_HOME/lib/fan/spectre.pod spectre/lib/fan/
Now add spectre/bin
to your $PATH
and that’s it.