I am having trouble with cppcms hello world example with url mapping.
I am having trouble with understanding this part:
int main(int argc,char ** argv)
{
try {
cppcms::service srv(argc,argv);
srv.applications_pool().mount(
cppcms::applications_factory<hello>() //i do not understand this part
);
srv.run();
}
catch(std::exception const &e) {
std::cerr << e.what() << std::endl;
}
}
In tutorial said /hello - welcome function would be called but that is not what is happening. This method is called instead:
void hello::main(std::string /*url*/)
{
response().out() <<
"<html>\n"
"<body>\n"
" <h1>Hello World</h1>\n"
"</body>\n"
"</html>\n";
}
Welcome method look like this and it is defined in a scope of hello class:
void welcome()
{
response().out() <<
"<h1> Welcome To Page with links </h1>\n"
"<a href='" << url("/number",1) << "'>1</a><br>\n"
"<a href='" << url("/number",15) << "'>15</a><br>\n"
"<a href='" << url("/smile") << "' >:-)</a><br>\n";
}
I need some answers if you can help me. I am just trying to understand so if you could point me to right direction it would be great.