forked from pistacheio/pistache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
215 lines (149 loc) · 8.26 KB
/
index.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Pistache</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Pistache is a C++ REST framework focussed on high performance and clear API. Pistache is a free software written by Mathieu Stefani and available on Github - https://github.com/oktal/pistache
">
<link rel="canonical"
href="http://pistache.io/">
<!-- Harmony styles -->
<link rel="stylesheet" type="text/css" href="/assets/css/main.css">
<!-- Modernizr js -->
<script async src="/assets/js/modernizr.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.min.css" />
<!--[if lt IE 9]>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.0/gh-fork-ribbon.ie.min.css" />
<![endif]-->
<!-- IE Fixes -->
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="theme-base-01">
<header class="main-header">
<div class="wc-container">
<img id="img-logo" src="/assets/images/logo.png" />
<h1>
<a href="/">Pistache</a>
</h1>
<h2>An elegant C++ REST framework.</h2>
<ul>
<li>
<a class="active" href="/" class="active">Pistache</a><span>/</span>
</li>
<li>
<a href="/quickstart">Getting Started</a><span>/</span>
</li>
<li>
<a href="/guide/">User's Guide</a><span>/</span>
</li>
<li>
<a title="Pistache on Github"
href="https://github.com/oktal/pistache" target="_blank">
Source code
</a><span>/</span>
</li>
</ul>
<div style="text-align: center">
<iframe src="https://ghbtns.com/github-btn.html?user=oktal&repo=pistache&type=star&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px"></iframe>
<iframe src="https://ghbtns.com/github-btn.html?user=oktal&repo=pistache&type=fork&count=true&size=large" frameborder="0" scrolling="0" width="158px" height="30px"></iframe>
</div>
</div>
</header>
<div class="page-content wc-container">
<div class="post">
<h1>Pistache</h1>
<div class="post">
<p><code>Pistache</code> is a C++ REST framework written by <a href="https://github.com/oktal">Mathieu Stefani</a> at <a href="http://datacratic.com">Datacratic</a>.
It is written in pure C++11 with no external dependency and provides a low-level HTTP abstraction.</p>
<p><code>Pistache</code> provides both an HTTP client and server that can be used to create and query complex web and REST APIs.</p>
<p>It’s completly free and Apache-licensed.</p>
<h2 id="modern-api">Modern API</h2>
<p>Playing with Pistache and its modern API is fun and easy</p>
<figure class="highlight"><pre><code class="language-cpp" data-lang="cpp"><span class="k">struct</span> <span class="nl">HelloHandler</span> <span class="p">:</span> <span class="k">public</span> <span class="n">Http</span><span class="o">::</span><span class="n">Handler</span> <span class="p">{</span>
<span class="kt">void</span> <span class="n">onRequest</span><span class="p">(</span><span class="k">const</span> <span class="n">Http</span><span class="o">::</span><span class="n">Request</span><span class="o">&</span> <span class="n">req</span><span class="p">,</span> <span class="n">Http</span><span class="o">::</span><span class="n">ResponseWriter</span> <span class="n">response</span><span class="p">)</span> <span class="p">{</span>
<span class="n">response</span><span class="p">.</span><span class="n">send</span><span class="p">(</span><span class="n">Http</span><span class="o">::</span><span class="n">Code</span><span class="o">::</span><span class="n">Ok</span><span class="p">,</span> <span class="s">"Hello, World"</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
<span class="n">Http</span><span class="o">::</span><span class="n">listenAndServe</span><span class="o"><</span><span class="n">HelloHandler</span><span class="o">></span><span class="p">(</span><span class="s">"*:9080"</span><span class="p">);</span>
<span class="p">}</span></code></pre></figure>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">curl http://127.0.0.1:9080
Hello, World</code></pre></figure>
<h2 id="whats-in-the-box">What’s in the box</h2>
<ul>
<li>A multi-threaded http server to build your APIs</li>
<li>An asynchronous http client to request APIS</li>
<li>An HTTP router to dispatch requests to C++ functions</li>
<li>A REST description DSL to easily define your APIs</li>
<li>Type-safe headers and MIME types implementation</li>
</ul>
<h2 id="use-it">Use it</h2>
<ul>
<li>Clone it on <a href="http://github.com/oktal/pistache">github</a></li>
<li>Start with the <a href="quickstart">quickstart</a></li>
<li>Read the full user’s <a href="guide">guide</a></li>
<li>Have issues with it ? Fill an <a href="https://github.com/oktal/pistache/issues">issue</a></li>
</ul>
</div>
</div>
</div>
<footer class="main-footer">
<div class="wc-container">
<div class="column one">
<h6>Few more links</h6>
<ul class="menu">
</ul>
</div>
<div class="column two">
<h6>Follow me</h6>
<ul class="social-media">
<li>
<a title="oktal on Github"
href="https://github.com/oktal"
class="github wc-img-replace" target="_blank">Github</a>
</li>
</ul>
</div>
</div>
<p class="wc-container disclaimer">
Powered by <a href="http://jekyllrb.com" target="_blank">Jekyll</a>
</p>
</footer>
<script type="text/javascript">
/* To avoid render blocking css */
var cb = function() {
var l = document.createElement('link'); l.rel = 'stylesheet';
l.href = 'http://fonts.googleapis.com/css?family=Ubuntu+Mono&subset=latin';
var h = document.getElementsByTagName('head')[0]; h.parentNode.insertBefore(l, h);
};
var raf = requestAnimationFrame || mozRequestAnimationFrame ||
webkitRequestAnimationFrame || msRequestAnimationFrame;
if (raf) raf(cb);
else window.addEventListener('load', cb);
</script>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- When no internet load JQuery from local -->
<script>window.jQuery || document.write('<script src="/assets/js/jquery.min.js"><\/script>')</script>
<!-- Site js -->
<script src="/assets/js/all.js"></script>
<!-- Google analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxx-x']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>