I have a big haxe/js/php-neko application running on a production server with the wonderful jquery extern,
I was thinking of putting together an example to github but I am short in time so It's not gonna happen any time soon,
let me explain what I did.
Basically I foud that the singleton pattern works very well with single page applications,
In the client, I have a class that manage all my routes:
public function mainRouter(routeOrg:String) {
var splitRoute = routeOrg.split("/");
var route:String = splitRoute[0];
if (!loginController.canUserLog(route)) {
change("#");
loginController.cleanSession(); <-- If you want authenticated users
loginController.drawUi();
}else {
switch (route) {
case "#main" :
changeState(route);
case "#page-A" :
changeState(route);
case "#page-B" :
changeState(route);
case "#page-C" :
changeState(route);
case "... etc" :
default :
changeState("#main");
mainController.drawUi();
}
}
}
public function changeState(state:String) {
Browser.window.history.pushState(null, null, estado);
}
so with these routes I have only one html page and all I do is render the content into the page according to te route, also with this pattern I manage make my application multilanguage I use Bootstrap and FontAwesome for all my basic ui needs and svg for more complex ui requirements, with JQuery to manipulate the html and the svg's dom.
To comunicate with the server I use haxeRemote and the server have a class that handle all the requests:
static function main() {
var database: Database = new Database();
aaaApi = new aaaApi();
bbbApi = new bbbApi();
cccApi = new cccApi();
dddApi = new dddApi();
var ctx = new Context();
ctx.addObject("aaaApi", aaaApi);
ctx.addObject("bbbApi", aaaApi);
ctx.addObject("cccApi", aaaApi);
ctx.addObject("dddApi", aaaApi);
if( haxe.remoting.HttpConnection.handleRequest(ctx) )
return;
// If the server can't handle the request print this.
Lib.print("Cant handle request");
Manager.cleanup();
}
In the server I mainly use php but if I have my own server I use Tora/Neko for my database I use MySql
Also I try ti keep everything simple and modular for make it easy to revisit.
Also you can do a search in github there are some excelent libraries like Detox from Jason O'Neal
https://github.com/jasononeil/detoxand the good work of many haxers around the world, just keep searchin in github, you can get there all the answers.
In the outdated Haxe books you can find examples that still works well with these targets.
Hope this could help.
Best Regards