ultimatepp/tutorial/Skylark08/main.cpp
cxl 32aec6d8f8 .tutorial: Skylark Ajax
git-svn-id: svn://ultimatepp.org/upp/trunk@5149 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2012-07-08 13:11:41 +00:00

35 lines
536 B
C++

#include <Skylark/Skylark.h>
using namespace Upp;
SKYLARK(HomePage, "")
{
http.RenderResult("Skylark08/index");
}
SKYLARK(Add, "add:POST")
{
String r = AsString(Nvl(http.Int("number1")) + Nvl(http.Int("number2")));
http.Ux("result", "The result is: " + r)
.UxSet("number1", r);
}
struct MyApp : SkylarkApp {
MyApp() {
root = "myapp";
#ifdef _DEBUG
prefork = 0;
use_caching = false;
#endif
}
};
CONSOLE_APP_MAIN
{
#ifdef _DEBUG
StdLogSetup(LOG_FILE|LOG_COUT);
Ini::skylark_log = true;
#endif
MyApp().Run();
}