I want to declare 2 routes. The first one, "/api"
will provide some REST stuff, and the other one, "/static"
should serve static content.
I tried to start from the quick start samples, but I don't know how to do this.
import tink.http.containers.*;
import tink.http.Response;
import tink.web.routing.*;
class Server {
static function main() {
var container = new NodeContainer(8080);
var router = new Router<Root>(new Root());
container.run(function(req) {
return router.route(Context.ofRequest(req))
.recover(OutgoingResponse.reportError);
});
}
}
class Root {
public function new() {}
@:get('/')
@:get('/$name')
public function hello(name = 'World')
return 'Hello, $name!';
}