rikitiki  v0.1.67
Build C++ web server modules that allow easy routing and deployment.
helloWorld.h
1 /* Copyright (C) 2012-2013 Justin Berger
2  The full license is available in the LICENSE file at the root of this project and is also available at http://opensource.org/licenses/MIT. */
3 
4 #include <rikitiki/rikitiki>
5 #include <rikitiki/mongoose/mongoose>
6 
7 using namespace rikitiki;
8 using namespace rikitiki::mongoose;
9 
10 namespace rikitiki {
11  namespace examples {
15  void Register(Server& server){
16  server.AddHandler( CreateRoute<>::With(this, "/hw/hello") );
17  server.AddHandler( CreateRoute<int>::With(this, "/hw/{number}") );
18  server.AddHandler( CreateRoute<std::string>::With(this, "/hw/{word}") );
19  }
20 
21  void operator()(ConnContext& ctx){
22  ctx << "Hello world!";
23  }
24 
25  void operator()(ConnContext& ctx, int number){
26  ctx << "Number: " << number;
27  }
28 
29  void operator()(ConnContext& ctx, const std::string& word){
30  ctx << "Word: " << word;
31  }
32  };
33  }
34 }
35