Menu

[r754]: / framework / branches / refactoring / hello_world.cpp  Maximize  Restore  History

Download this file

38 lines (33 with data), 703 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "application.h"
#include "url_dispatcher.h"
#include "applications_pool.h"
#include "service.h"
#include "http_response.h"
class hello : public cppcms::application {
public:
hello(cppcms::service &srv) :
cppcms::application(srv)
{
dispatcher().assign(".*",&hello::hello_world,this);
}
void hello_world()
{
response().out() <<
"<html><body>\n"
"<h1>Hello World!</h1>\n"
"<body></html>\n";
}
};
int main(int argc,char **argv)
{
try {
cppcms::service service(argc,argv);
service.applications_pool().mount(".*",cppcms::applications_factory<hello>());
service.run();
}
catch(std::exception const &e) {
std::cerr<<e.what()<<std::endl;
return 1;
}
return 0;
}
MongoDB Logo MongoDB