Prev | Current Page 464 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

For this reason, be sure that this directory has the correct permissions to allow
Neko to write in it.
The whole code needed to run the application will go in the src directory. The entry class is
WikiApplication and its definition is set in the WikiApplication.hx file.
import WikiController;
class WikiApplication
{
public static function main()
{
var uri = neko.Web.getURI();
var repositoryPath = neko.Sys.getCwd() + ???../pages???;
var params = neko.Web.getParams();
var action = switch(params.get(???action???))
Chapter 9: Building Websites with HaXe
241
{
case ???edit???:
Edit;
case ???save???:
Save(params.get(???content???));
default:
View;
}
var controller = new WikiController(uri, repositoryPath, action);
controller.execute();
}
}
The class contains just the main method that will be invoked every time that the web server calls the
Wiki application. To produce a valid response, some information must be acquired; first thing first, the
URI of the current requested page must be known so that it will be possible to load the matching content.


Pages:
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476