rikitiki
v0.1.67
Build C++ web server modules that allow easy routing and deployment.
Main Page
Related Pages
Classes
Files
File List
stencetEx.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
#pragma once
4
5
#include <rikitiki/rikitiki>
6
#include <rikitiki/mongoose/mongoose>
7
#include <stencet/stencet>
8
#include <mxcomp/variant.h>
9
10
using namespace
rikitiki;
11
using namespace
rikitiki::mongoose;
12
using namespace
stencet;
13
14
namespace
rikitiki {
15
namespace
examples {
16
17
struct
StencetExModule
{
18
void
Register(
Server
& server){
19
Template::Templates()[
"hw"
].Parse(
"<html><body>{{message}}</body></html>"
);
20
server.AddHandler(
CreateRoute<>::With
(
this
,
"/stencet"
) );
21
server.AddHandler(
CreateRoute<std::string>::With
(
this
,
"/stencet/fromfile/{0}"
) );
22
}
23
24
void
operator()(
ConnContext
& ctx){
25
Variant vm;
26
vm[
"message"
] =
"Hello world!"
;
27
ctx << Template::ByName(
"hw"
).With(vm);
28
}
29
30
void
operator()(
ConnContext
& ctx,
const
std::string& msg){
31
Variant vm;
32
vm[
"message"
] = msg;
33
ctx << Template::ByName(
"example"
).With(vm);
// Loads from file!
34
}
35
36
};
37
}
38
}
39
include
rikitiki
examples
stencetEx.h
Generated on Mon Apr 1 2013 18:17:04 for rikitiki by
1.8.3.1