Skip to content

Instantly share code, notes, and snippets.

@postite
Created February 12, 2016 08:35
Show Gist options
  • Save postite/2059bc4600f8115a8469 to your computer and use it in GitHub Desktop.
Save postite/2059bc4600f8115a8469 to your computer and use it in GitHub Desktop.
minimalist ufront example failing with compilation server
/*
build.hxml
-main App
-lib erazor
--connect 6000
--times
--each
-lib ufront-client
-D client
-js www/app.js
--next
-lib ufront-mvc
-D server
-neko www/index.n
#run nekotools server
-cmd open http://localhost:2000
*/
import ufront.MVC;
class App {
static var app: #if client ClientJsApplication #else UfrontApplication #end ;
public function new() {
#if server
app = new UfrontApplication({
indexController: HomeController,
templatingEngines: [TemplatingEngines.erazor],
defaultLayout: "layout.html",
});
#else
app = new ClientJsApplication({
indexController: HomeController,
templatingEngines: [TemplatingEngines.erazor],
defaultLayout: "layout.html",
});
app.listen();
#end
app.injector.map(String,"blob").toValue("blobi");
app.executeRequest();
}
static public function main() {
var app = new App();
}
}
class HomeController extends Controller{
@inject("blob")
public var blob:String;
@post
@:route("/")
public function index(){
return new ContentResult("o yeah"+blob);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment