Commit 11d10e19 authored by kiplingw's avatar kiplingw

deploy: 97db7ee7

parent 0f19a65d
SPDX-FileCopyrightText: 2021 Andrea Pappacoda
SPDX-License-Identifier: CC0-1.0
\ No newline at end of file
......@@ -5,13 +5,13 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-beta.1">
<title data-react-helmet="true">Page Not Found | Pistache</title><meta data-react-helmet="true" property="og:title" content="Page Not Found | Pistache"><meta data-react-helmet="true" property="og:url" content="https://pistache.io/404.html"><meta data-react-helmet="true" name="docusaurus_locale" content="en"><meta data-react-helmet="true" name="docusaurus_tag" content="default"><link data-react-helmet="true" rel="shortcut icon" href="/img/logo.png"><link data-react-helmet="true" rel="canonical" href="https://pistache.io/404.html"><link data-react-helmet="true" rel="alternate" href="https://pistache.io/404.html" hreflang="en"><link data-react-helmet="true" rel="alternate" href="https://pistache.io/404.html" hreflang="x-default"><link rel="stylesheet" href="/assets/css/styles.35f9fda9.css">
<link rel="preload" href="/assets/js/runtime~main.46269ba1.js" as="script">
<link rel="preload" href="/assets/js/runtime~main.53122274.js" as="script">
<link rel="preload" href="/assets/js/main.67d7f0b9.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div><a href="#main" class="skipToContent_1oUP shadow--md">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle clean-btn" type="button" tabindex="0"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><img src="/img/logo.png" alt="Pistache logo" class="themedImage_1VuW themedImage--light_3UqQ navbar__logo"><img src="/img/logo.png" alt="Pistache logo" class="themedImage_1VuW themedImage--dark_hz6m navbar__logo"><b class="navbar__title">Pistache</b></a><a class="navbar__item navbar__link" href="/docs/">Docs</a></div><div class="navbar__items navbar__items--right"><a href="https://github.com/pistacheio/pistache" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link header-github-link" aria-label="GitHub repository"></a><div class="react-toggle displayOnlyInLargeViewport_GrZ2 react-toggle--disabled"><div class="react-toggle-track" role="button" tabindex="-1"><div class="react-toggle-track-check"><span class="toggle_71bT">🌜</span></div><div class="react-toggle-track-x"><span class="toggle_71bT">🌞</span></div><div class="react-toggle-thumb"></div></div><input type="checkbox" class="react-toggle-screenreader-only" aria-label="Switch between dark and light mode"></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a class="navbar__brand" href="/"><img src="/img/logo.png" alt="Pistache logo" class="themedImage_1VuW themedImage--light_3UqQ navbar__logo"><img src="/img/logo.png" alt="Pistache logo" class="themedImage_1VuW themedImage--dark_hz6m navbar__logo"><b class="navbar__title">Pistache</b></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/">Docs</a></li><li class="menu__list-item"><a href="https://github.com/pistacheio/pistache" target="_blank" rel="noopener noreferrer" class="menu__link header-github-link" aria-label="GitHub repository"></a></li></ul></div></div></div></nav><div class="main-wrapper"><main class="container margin-vert--xl"><div class="row"><div class="col col--6 col--offset-3"><h1 class="hero__title">Page Not Found</h1><p>We could not find what you were looking for.</p><p>Please contact the owner of the site that linked you to the original URL and let them know their link is broken.</p></div></div></main></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Docs</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/">Quickstart</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/http-handler/">User guide</a></li></ul></div><div class="col footer__col"><div class="footer__title">Community</div><ul class="footer__items"><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/pistache" target="_blank" rel="noopener noreferrer" class="footer__link-item">Stack Overflow</a></li><li class="footer__item"><a href="https://web.libera.chat/#pistache" target="_blank" rel="noopener noreferrer" class="footer__link-item">#pistache on Libera.Chat</a></li></ul></div><div class="col footer__col"><div class="footer__title">More</div><ul class="footer__items"><li class="footer__item"><a href="https://github.com/pistacheio/pistache" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li></ul></div></div><div class="footer__bottom text--center"><div class="footer__copyright">Pistache, 2015 - 2021</div></div></div></footer></div>
<script src="/assets/js/runtime~main.46269ba1.js"></script>
<script src="/assets/js/runtime~main.53122274.js"></script>
<script src="/assets/js/main.67d7f0b9.js"></script>
</body>
</html>
\ No newline at end of file
(self.webpackChunkpistache_io=self.webpackChunkpistache_io||[]).push([[651],{7917:function(e,t,n){"use strict";n.r(t),n.d(t,{frontMatter:function(){return r},contentTitle:function(){return o},metadata:function(){return p},toc:function(){return c},default:function(){return u}});var a=n(2122),l=n(9756),i=(n(7294),n(3905)),s=["components"],r={title:"Getting started",slug:"/"},o=void 0,p={unversionedId:"quickstart",id:"quickstart",isDocsHomePage:!1,title:"Getting started",description:"\x3c!--",source:"@site/docs/quickstart.md",sourceDirName:".",slug:"/",permalink:"/docs/",editUrl:"https://github.com/pistacheio/pistache/edit/master/pistache.io/docs/quickstart.md",version:"current",frontMatter:{title:"Getting started",slug:"/"},sidebar:"leftSidebar",previous:{title:"HTTP handler",permalink:"/docs/http-handler"},next:{title:"REST description",permalink:"/docs/rest-description"}},c=[{value:"Installing Pistache",id:"installing-pistache",children:[]},{value:"Serving requests",id:"serving-requests",children:[{value:"Include",id:"include",children:[]},{value:"Hello world",id:"hello-world",children:[]},{value:"Final touch",id:"final-touch",children:[]}]}],d={toc:c};function u(e){var t=e.components,n=(0,l.Z)(e,s);return(0,i.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pistache is a web framework written in Modern C++ that focuses on performance and provides an elegant and asynchronous API."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cpp"},"#include <pistache/pistache.h>\n")),(0,i.kt)("h2",{id:"installing-pistache"},"Installing Pistache"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://git-scm.com"},"git")," is needed to retrieve the sources. Compiling the sources will require ",(0,i.kt)("a",{parentName:"p",href:"https://cmake.org"},"CMake")," to generate build files and a recent compiler that supports C++17."),(0,i.kt)("p",null,"If you're on Ubuntu and want to skip the compilation process you can add the official PPA providing nightly builds:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"sudo add-apt-repository ppa:pistache+team/unstable\nsudo apt update\nsudo apt install libpistache-dev\n")),(0,i.kt)("p",null,"Otherwise, here's how to build and install the latest release:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"git clone https://github.com/pistacheio/pistache.git\ncd pistache\nmeson setup build\nmeson install -C build\n")),(0,i.kt)("p",null,"Also, Pistache does not support Windows yet, but should work fine under ",(0,i.kt)("a",{parentName:"p",href:"https://docs.microsoft.com/windows/wsl/about"},"WSL"),"."),(0,i.kt)("h2",{id:"serving-requests"},"Serving requests"),(0,i.kt)("h3",{id:"include"},"Include"),(0,i.kt)("p",null,"First, let\u2019s start by including the right header."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cpp"},"#include <pistache/endpoint.h>\n")),(0,i.kt)("h3",{id:"hello-world"},"Hello world"),(0,i.kt)("p",null,"Requests received by Pistache are handled with an ",(0,i.kt)("inlineCode",{parentName:"p"},"Http::Handler"),"."),(0,i.kt)("p",null,"Let\u2019s start by defining a simple ",(0,i.kt)("inlineCode",{parentName:"p"},"HelloHandler"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cpp"},'using namespace Pistache;\n\nclass HelloHandler : public Http::Handler {\npublic:\n\n HTTP_PROTOTYPE(HelloHandler)\n\n void onRequest(const Http::Request& request, Http::ResponseWriter response) {\n response.send(Http::Code::Ok, "Hello, World\\n");\n }\n};\n')),(0,i.kt)("p",null,"Handlers must inherit the ",(0,i.kt)("inlineCode",{parentName:"p"},"Http::Handler")," class and at least define the ",(0,i.kt)("inlineCode",{parentName:"p"},"onRequest")," member function. They must also define a ",(0,i.kt)("inlineCode",{parentName:"p"},"clone()")," member function. Simple handlers can use the special ",(0,i.kt)("inlineCode",{parentName:"p"},"HTTP_PROTOTYPE")," macro, passing in the name of the class. The macro will take care of defining the ",(0,i.kt)("inlineCode",{parentName:"p"},"clone()")," member function for you."),(0,i.kt)("h3",{id:"final-touch"},"Final touch"),(0,i.kt)("p",null,"After defining the handler, the server can now be started:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cpp"},"int main() {\n Address addr(Ipv4::any(), Port(9080));\n\n auto opts = Http::Endpoint::options().threads(1);\n Http::Endpoint server(addr);\n server.init(opts);\n server.setHandler(Http::make_handler<HelloHandler>());\n server.serve();\n}\n")),(0,i.kt)("p",null,"For simplicity, you can also use the special ",(0,i.kt)("inlineCode",{parentName:"p"},"listenAndServe")," function that will automatically create an endpoint and instantiate your handler:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cpp"},'int main() {\n Http::listenAndServe<HelloHandler>("*:9080");\n}\n')),(0,i.kt)("p",null,"And that\u2019s it, now you can fire up your favorite curl request and observe the final result:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"curl http://localhost:9080/\nHello, World\n")),(0,i.kt)("p",null,"Complete code for this example can be found on GitHub: ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/pistacheio/pistache/blob/master/examples/hello_server.cc"},"examples/hello_server.cc")))}u.isMDXComponent=!0}}]);
\ No newline at end of file
(self.webpackChunkpistache_io=self.webpackChunkpistache_io||[]).push([[651],{7917:function(e,t,n){"use strict";n.r(t),n.d(t,{frontMatter:function(){return r},contentTitle:function(){return o},metadata:function(){return p},toc:function(){return c},default:function(){return u}});var a=n(2122),l=n(9756),i=(n(7294),n(3905)),s=["components"],r={title:"Getting started",slug:"/"},o=void 0,p={unversionedId:"quickstart",id:"quickstart",isDocsHomePage:!1,title:"Getting started",description:"Pistache is a web framework written in Modern C++ that focuses on performance and provides an elegant and asynchronous API.",source:"@site/docs/quickstart.md",sourceDirName:".",slug:"/",permalink:"/docs/",editUrl:"https://github.com/pistacheio/pistache/edit/master/pistache.io/docs/quickstart.md",version:"current",frontMatter:{title:"Getting started",slug:"/"},sidebar:"leftSidebar",previous:{title:"HTTP handler",permalink:"/docs/http-handler"},next:{title:"REST description",permalink:"/docs/rest-description"}},c=[{value:"Installing Pistache",id:"installing-pistache",children:[]},{value:"Serving requests",id:"serving-requests",children:[{value:"Include",id:"include",children:[]},{value:"Hello world",id:"hello-world",children:[]},{value:"Final touch",id:"final-touch",children:[]}]}],d={toc:c};function u(e){var t=e.components,n=(0,l.Z)(e,s);return(0,i.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Pistache is a web framework written in Modern C++ that focuses on performance and provides an elegant and asynchronous API."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cpp"},"#include <pistache/pistache.h>\n")),(0,i.kt)("h2",{id:"installing-pistache"},"Installing Pistache"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://git-scm.com"},"git")," is needed to retrieve the sources. Compiling the sources will require ",(0,i.kt)("a",{parentName:"p",href:"https://cmake.org"},"CMake")," to generate build files and a recent compiler that supports C++17."),(0,i.kt)("p",null,"If you're on Ubuntu and want to skip the compilation process you can add the official PPA providing nightly builds:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"sudo add-apt-repository ppa:pistache+team/unstable\nsudo apt update\nsudo apt install libpistache-dev\n")),(0,i.kt)("p",null,"Otherwise, here's how to build and install the latest release:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"git clone https://github.com/pistacheio/pistache.git\ncd pistache\nmeson setup build\nmeson install -C build\n")),(0,i.kt)("p",null,"Also, Pistache does not support Windows yet, but should work fine under ",(0,i.kt)("a",{parentName:"p",href:"https://docs.microsoft.com/windows/wsl/about"},"WSL"),"."),(0,i.kt)("h2",{id:"serving-requests"},"Serving requests"),(0,i.kt)("h3",{id:"include"},"Include"),(0,i.kt)("p",null,"First, let\u2019s start by including the right header."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cpp"},"#include <pistache/endpoint.h>\n")),(0,i.kt)("h3",{id:"hello-world"},"Hello world"),(0,i.kt)("p",null,"Requests received by Pistache are handled with an ",(0,i.kt)("inlineCode",{parentName:"p"},"Http::Handler"),"."),(0,i.kt)("p",null,"Let\u2019s start by defining a simple ",(0,i.kt)("inlineCode",{parentName:"p"},"HelloHandler"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cpp"},'using namespace Pistache;\n\nclass HelloHandler : public Http::Handler {\npublic:\n\n HTTP_PROTOTYPE(HelloHandler)\n\n void onRequest(const Http::Request& request, Http::ResponseWriter response) {\n response.send(Http::Code::Ok, "Hello, World\\n");\n }\n};\n')),(0,i.kt)("p",null,"Handlers must inherit the ",(0,i.kt)("inlineCode",{parentName:"p"},"Http::Handler")," class and at least define the ",(0,i.kt)("inlineCode",{parentName:"p"},"onRequest")," member function. They must also define a ",(0,i.kt)("inlineCode",{parentName:"p"},"clone()")," member function. Simple handlers can use the special ",(0,i.kt)("inlineCode",{parentName:"p"},"HTTP_PROTOTYPE")," macro, passing in the name of the class. The macro will take care of defining the ",(0,i.kt)("inlineCode",{parentName:"p"},"clone()")," member function for you."),(0,i.kt)("h3",{id:"final-touch"},"Final touch"),(0,i.kt)("p",null,"After defining the handler, the server can now be started:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cpp"},"int main() {\n Address addr(Ipv4::any(), Port(9080));\n\n auto opts = Http::Endpoint::options().threads(1);\n Http::Endpoint server(addr);\n server.init(opts);\n server.setHandler(Http::make_handler<HelloHandler>());\n server.serve();\n}\n")),(0,i.kt)("p",null,"For simplicity, you can also use the special ",(0,i.kt)("inlineCode",{parentName:"p"},"listenAndServe")," function that will automatically create an endpoint and instantiate your handler:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-cpp"},'int main() {\n Http::listenAndServe<HelloHandler>("*:9080");\n}\n')),(0,i.kt)("p",null,"And that\u2019s it, now you can fire up your favorite curl request and observe the final result:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"curl http://localhost:9080/\nHello, World\n")),(0,i.kt)("p",null,"Complete code for this example can be found on GitHub: ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/pistacheio/pistache/blob/master/examples/hello_server.cc"},"examples/hello_server.cc")))}u.isMDXComponent=!0}}]);
\ No newline at end of file
(self.webpackChunkpistache_io=self.webpackChunkpistache_io||[]).push([[659],{4660:function(t,e,i){"use strict";i.r(e),i.d(e,{frontMatter:function(){return c},contentTitle:function(){return p},metadata:function(){return a},toc:function(){return d},default:function(){return l}});var r=i(2122),n=i(9756),s=(i(7294),i(3905)),o=["components"],c={title:"REST description"},p=void 0,a={unversionedId:"rest-description",id:"rest-description",isDocsHomePage:!1,title:"REST description",description:"\x3c!--",source:"@site/docs/rest-description.md",sourceDirName:".",slug:"/rest-description",permalink:"/docs/rest-description",editUrl:"https://github.com/pistacheio/pistache/edit/master/pistache.io/docs/rest-description.md",version:"current",frontMatter:{title:"REST description"},sidebar:"leftSidebar",previous:{title:"Getting started",permalink:"/docs/"},next:{title:"Routing",permalink:"/docs/routing"}},d=[],u={toc:d};function l(t){var e=t.components,i=(0,n.Z)(t,o);return(0,s.kt)("wrapper",(0,r.Z)({},u,i,{components:e,mdxType:"MDXLayout"}),(0,s.kt)("p",null,"Documentation writing for this part is still in progress, please refer to the ",(0,s.kt)("a",{parentName:"p",href:"https://github.com/pistacheio/pistache/blob/master/examples/rest_description.cc"},"rest_description")," example."))}l.isMDXComponent=!0}}]);
\ No newline at end of file
(self.webpackChunkpistache_io=self.webpackChunkpistache_io||[]).push([[659],{4660:function(t,e,i){"use strict";i.r(e),i.d(e,{frontMatter:function(){return c},contentTitle:function(){return p},metadata:function(){return a},toc:function(){return d},default:function(){return l}});var r=i(2122),s=i(9756),n=(i(7294),i(3905)),o=["components"],c={title:"REST description"},p=void 0,a={unversionedId:"rest-description",id:"rest-description",isDocsHomePage:!1,title:"REST description",description:"Documentation writing for this part is still in progress, please refer to the restdescription example.",source:"@site/docs/rest-description.md",sourceDirName:".",slug:"/rest-description",permalink:"/docs/rest-description",editUrl:"https://github.com/pistacheio/pistache/edit/master/pistache.io/docs/rest-description.md",version:"current",frontMatter:{title:"REST description"},sidebar:"leftSidebar",previous:{title:"Getting started",permalink:"/docs/"},next:{title:"Routing",permalink:"/docs/routing"}},d=[],u={toc:d};function l(t){var e=t.components,i=(0,s.Z)(t,o);return(0,n.kt)("wrapper",(0,r.Z)({},u,i,{components:e,mdxType:"MDXLayout"}),(0,n.kt)("p",null,"Documentation writing for this part is still in progress, please refer to the ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/pistacheio/pistache/blob/master/examples/rest_description.cc"},"rest_description")," example."))}l.isMDXComponent=!0}}]);
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
(self.webpackChunkpistache_io=self.webpackChunkpistache_io||[]).push([[489],{2509:function(e,t,n){"use strict";n.r(t),n.d(t,{frontMatter:function(){return s},contentTitle:function(){return l},metadata:function(){return c},toc:function(){return p},default:function(){return m}});var a=n(2122),r=n(9756),o=(n(7294),n(3905)),i=["components"],s={title:"Asynchronous HTTP programming"},l=void 0,c={unversionedId:"asynchronous-http-programming",id:"asynchronous-http-programming",isDocsHomePage:!1,title:"Asynchronous HTTP programming",description:"Interfaces provided by Pistaches are asynchronous and non-blocking. Asynchronous programming allows for code to continue executing even if the result of a given call is not available yet. Calls that provide an asynchronous interface are referred to asynchronous calls.",source:"@site/docs/asynchronous-http-programming.md",sourceDirName:".",slug:"/asynchronous-http-programming",permalink:"/docs/asynchronous-http-programming",editUrl:"https://github.com/pistacheio/pistache/edit/master/pistache.io/docs/asynchronous-http-programming.md",version:"current",frontMatter:{title:"Asynchronous HTTP programming"},sidebar:"leftSidebar",next:{title:"Headers",permalink:"/docs/headers"}},p=[],h={toc:p};function m(e){var t=e.components,n=(0,r.Z)(e,i);return(0,o.kt)("wrapper",(0,a.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Interfaces provided by Pistaches are ",(0,o.kt)("em",{parentName:"p"},"asynchronous")," and ",(0,o.kt)("em",{parentName:"p"},"non-blocking"),". Asynchronous programming allows for code to continue executing even if the result of a given call is not available yet. Calls that provide an asynchronous interface are referred to ",(0,o.kt)("em",{parentName:"p"},"asynchronous calls"),"."),(0,o.kt)("p",null,"An example of such a call is the ",(0,o.kt)("inlineCode",{parentName:"p"},"send()")," function provided by the ",(0,o.kt)("inlineCode",{parentName:"p"},"ResponseWriter")," interface. This function returns the number of bytes written to the socket file descriptor associated to the connection. However, instead of returning directly the value to the caller and thus blocking the caller, it wraps the value into a component called a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise"),"."),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," is the Pistache\u2019s implementation of the ",(0,o.kt)("a",{parentName:"p",href:"https://promisesaplus.com"},"Promises/A+")," standard available in many JavaScript implementations. Simply put, during an asynchronous call, a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," separates the launch of an asynchronous operation from the retrieval of its result. While the asynchronous might still be running, a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise<T>")," is directly returned to the caller to retrieve the final result when it becomes available. A so called continuation can be attach to a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," to execute a callback when the result becomes available (when the ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," has been resolved or fulfilled)."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cpp"},'auto res = response.send(Http::Code::Ok, "Hello World");\nres.then(\n [](ssize_t bytes) { std::cout << bytes << " bytes have been sent\\n" },\n Async::NoExcept\n);\n')),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"then()")," member is used to attach a callback to the ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise"),". The first argument is a callable that will be called when the ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," has been ",(0,o.kt)("strong",{parentName:"p"},"succesfully")," resolved. If, for some reason, an error occurs during the asynchronous operation, a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," can be ",(0,o.kt)("strong",{parentName:"p"},"rejected")," and will then fail. In this case, the second callable will be called. ",(0,o.kt)("inlineCode",{parentName:"p"},"Async::NoExcept")," is a special callback that will call ",(0,o.kt)("a",{parentName:"p",href:"https://en.cppreference.com/w/cpp/error/terminate"},(0,o.kt)("inlineCode",{parentName:"a"},"std::terminate()"))," if the promise failed. This is the equivalent of the ",(0,o.kt)("inlineCode",{parentName:"p"},"noexcept")," keyword."),(0,o.kt)("p",null,"Other generic callbacks can also be used in this case:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Async::IgnoreException")," will simply ignore the exception and let the program continue"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Async::Throw"),' will "rethrow" the exception up to an eventual promise call-chain. This has the same effect than the ',(0,o.kt)("inlineCode",{parentName:"li"},"throw")," keyword, except that it is suitable for promises")),(0,o.kt)("p",null,"Exceptions in promises callbacks are propagated through an ",(0,o.kt)("inlineCode",{parentName:"p"},"exception_ptr"),". Promises can also be chained together to create a whole asynchronous pipeline:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cpp"},'auto fetchOp = fetchDatabase();\nfetchOp\n .then(\n [](const User& user) { return fetchUserInfo(user); },\n Async::Throw)\n .then(\n [](const UserInfo& info) { std::cout << "User name = " << info.name << \'\\n\'; },\n [](exception_ptr ptr) { std::cerr << "An exception occured during user retrieval\\n";}\n);\n')),(0,o.kt)("p",null,"Line 5 will propagate the exception if ",(0,o.kt)("inlineCode",{parentName:"p"},"fetchDatabase()")," failed and rejected the promise."))}m.isMDXComponent=!0}}]);
\ No newline at end of file
(self.webpackChunkpistache_io=self.webpackChunkpistache_io||[]).push([[489],{2509:function(e,t,n){"use strict";n.r(t),n.d(t,{frontMatter:function(){return s},contentTitle:function(){return l},metadata:function(){return c},toc:function(){return p},default:function(){return m}});var a=n(2122),r=n(9756),o=(n(7294),n(3905)),i=["components"],s={title:"Asynchronous HTTP programming"},l=void 0,c={unversionedId:"asynchronous-http-programming",id:"asynchronous-http-programming",isDocsHomePage:!1,title:"Asynchronous HTTP programming",description:"\x3c!--",source:"@site/docs/asynchronous-http-programming.md",sourceDirName:".",slug:"/asynchronous-http-programming",permalink:"/docs/asynchronous-http-programming",editUrl:"https://github.com/pistacheio/pistache/edit/master/pistache.io/docs/asynchronous-http-programming.md",version:"current",frontMatter:{title:"Asynchronous HTTP programming"},sidebar:"leftSidebar",next:{title:"Headers",permalink:"/docs/headers"}},p=[],h={toc:p};function m(e){var t=e.components,n=(0,r.Z)(e,i);return(0,o.kt)("wrapper",(0,a.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"Interfaces provided by Pistaches are ",(0,o.kt)("em",{parentName:"p"},"asynchronous")," and ",(0,o.kt)("em",{parentName:"p"},"non-blocking"),". Asynchronous programming allows for code to continue executing even if the result of a given call is not available yet. Calls that provide an asynchronous interface are referred to ",(0,o.kt)("em",{parentName:"p"},"asynchronous calls"),"."),(0,o.kt)("p",null,"An example of such a call is the ",(0,o.kt)("inlineCode",{parentName:"p"},"send()")," function provided by the ",(0,o.kt)("inlineCode",{parentName:"p"},"ResponseWriter")," interface. This function returns the number of bytes written to the socket file descriptor associated to the connection. However, instead of returning directly the value to the caller and thus blocking the caller, it wraps the value into a component called a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise"),"."),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," is the Pistache\u2019s implementation of the ",(0,o.kt)("a",{parentName:"p",href:"https://promisesaplus.com"},"Promises/A+")," standard available in many JavaScript implementations. Simply put, during an asynchronous call, a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," separates the launch of an asynchronous operation from the retrieval of its result. While the asynchronous might still be running, a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise<T>")," is directly returned to the caller to retrieve the final result when it becomes available. A so called continuation can be attach to a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," to execute a callback when the result becomes available (when the ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," has been resolved or fulfilled)."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cpp"},'auto res = response.send(Http::Code::Ok, "Hello World");\nres.then(\n [](ssize_t bytes) { std::cout << bytes << " bytes have been sent\\n" },\n Async::NoExcept\n);\n')),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"then()")," member is used to attach a callback to the ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise"),". The first argument is a callable that will be called when the ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," has been ",(0,o.kt)("strong",{parentName:"p"},"succesfully")," resolved. If, for some reason, an error occurs during the asynchronous operation, a ",(0,o.kt)("inlineCode",{parentName:"p"},"Promise")," can be ",(0,o.kt)("strong",{parentName:"p"},"rejected")," and will then fail. In this case, the second callable will be called. ",(0,o.kt)("inlineCode",{parentName:"p"},"Async::NoExcept")," is a special callback that will call ",(0,o.kt)("a",{parentName:"p",href:"https://en.cppreference.com/w/cpp/error/terminate"},(0,o.kt)("inlineCode",{parentName:"a"},"std::terminate()"))," if the promise failed. This is the equivalent of the ",(0,o.kt)("inlineCode",{parentName:"p"},"noexcept")," keyword."),(0,o.kt)("p",null,"Other generic callbacks can also be used in this case:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Async::IgnoreException")," will simply ignore the exception and let the program continue"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Async::Throw"),' will "rethrow" the exception up to an eventual promise call-chain. This has the same effect than the ',(0,o.kt)("inlineCode",{parentName:"li"},"throw")," keyword, except that it is suitable for promises")),(0,o.kt)("p",null,"Exceptions in promises callbacks are propagated through an ",(0,o.kt)("inlineCode",{parentName:"p"},"exception_ptr"),". Promises can also be chained together to create a whole asynchronous pipeline:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cpp"},'auto fetchOp = fetchDatabase();\nfetchOp\n .then(\n [](const User& user) { return fetchUserInfo(user); },\n Async::Throw)\n .then(\n [](const UserInfo& info) { std::cout << "User name = " << info.name << \'\\n\'; },\n [](exception_ptr ptr) { std::cerr << "An exception occured during user retrieval\\n";}\n);\n')),(0,o.kt)("p",null,"Line 5 will propagate the exception if ",(0,o.kt)("inlineCode",{parentName:"p"},"fetchDatabase()")," failed and rejected the promise."))}m.isMDXComponent=!0}}]);
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
!function(){"use strict";var e,t,n,r,o,u={},i={};function f(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={id:e,loaded:!1,exports:{}};return u[e].call(n.exports,n,n.exports,f),n.loaded=!0,n.exports}f.m=u,f.c=i,e=[],f.O=function(t,n,r,o){if(!n){var u=1/0;for(a=0;a<e.length;a++){n=e[a][0],r=e[a][1],o=e[a][2];for(var i=!0,c=0;c<n.length;c++)(!1&o||u>=o)&&Object.keys(f.O).every((function(e){return f.O[e](n[c])}))?n.splice(c--,1):(i=!1,o<u&&(u=o));i&&(e.splice(a--,1),t=r())}return t}o=o||0;for(var a=e.length;a>0&&e[a-1][2]>o;a--)e[a]=e[a-1];e[a]=[n,r,o]},f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},f.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);f.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach((function(t){u[t]=function(){return e[t]}}));return u.default=function(){return e},f.d(o,u),o},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce((function(t,n){return f.f[n](e,t),t}),[]))},f.u=function(e){return"assets/js/"+({1:"f811e444",53:"935f2afb",195:"c4f5d8e4",427:"e7b197f4",489:"e7cdbb73",514:"1be78505",536:"e9d16704",592:"common",651:"8070e160",659:"88aa539f",918:"17896441"}[e]||e)+"."+{1:"4fd5c778",53:"e3ad223e",195:"25413e05",349:"4c4b6438",427:"18b1c9fa",489:"1b1aa4a3",514:"cfa83cbf",536:"d59286b0",592:"aaba9bd1",608:"e7ce046d",651:"a38ccea7",659:"ddd812ae",918:"7543c8e6"}[e]+".js"},f.miniCssF=function(e){return"assets/css/styles.35f9fda9.css"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="pistache-io:",f.l=function(e,t,n,u){if(r[e])r[e].push(t);else{var i,c;if(void 0!==n)for(var a=document.getElementsByTagName("script"),s=0;s<a.length;s++){var d=a[s];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==o+n){i=d;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,f.nc&&i.setAttribute("nonce",f.nc),i.setAttribute("data-webpack",o+n),i.src=e),r[e]=[t];var l=function(t,n){i.onerror=i.onload=null,clearTimeout(b);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach((function(e){return e(n)})),t)return t(n)},b=setTimeout(l.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=l.bind(null,i.onerror),i.onload=l.bind(null,i.onload),c&&document.head.appendChild(i)}},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.p="/",f.gca=function(e){return e={17896441:"918",f811e444:"1","935f2afb":"53",c4f5d8e4:"195",e7b197f4:"427",e7cdbb73:"489","1be78505":"514",e9d16704:"536",common:"592","8070e160":"651","88aa539f":"659"}[e]||e,f.p+f.u(e)},function(){var e={303:0,532:0};f.f.j=function(t,n){var r=f.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else if(/^(303|532)$/.test(t))e[t]=0;else{var o=new Promise((function(n,o){r=e[t]=[n,o]}));n.push(r[2]=o);var u=f.p+f.u(t),i=new Error;f.l(u,(function(n){if(f.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),u=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+o+": "+u+")",i.name="ChunkLoadError",i.type=o,i.request=u,r[1](i)}}),"chunk-"+t,t)}},f.O.j=function(t){return 0===e[t]};var t=function(t,n){var r,o,u=n[0],i=n[1],c=n[2],a=0;for(r in i)f.o(i,r)&&(f.m[r]=i[r]);if(c)var s=c(f);for(t&&t(n);a<u.length;a++)o=u[a],f.o(e,o)&&e[o]&&e[o][0](),e[u[a]]=0;return f.O(s)},n=self.webpackChunkpistache_io=self.webpackChunkpistache_io||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}()}();
\ No newline at end of file
!function(){"use strict";var e,t,n,r,o,u={},i={};function f(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={id:e,loaded:!1,exports:{}};return u[e].call(n.exports,n,n.exports,f),n.loaded=!0,n.exports}f.m=u,f.c=i,e=[],f.O=function(t,n,r,o){if(!n){var u=1/0;for(a=0;a<e.length;a++){n=e[a][0],r=e[a][1],o=e[a][2];for(var i=!0,c=0;c<n.length;c++)(!1&o||u>=o)&&Object.keys(f.O).every((function(e){return f.O[e](n[c])}))?n.splice(c--,1):(i=!1,o<u&&(u=o));i&&(e.splice(a--,1),t=r())}return t}o=o||0;for(var a=e.length;a>0&&e[a-1][2]>o;a--)e[a]=e[a-1];e[a]=[n,r,o]},f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},f.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);f.r(o);var u={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;"object"==typeof i&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach((function(t){u[t]=function(){return e[t]}}));return u.default=function(){return e},f.d(o,u),o},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce((function(t,n){return f.f[n](e,t),t}),[]))},f.u=function(e){return"assets/js/"+({1:"f811e444",53:"935f2afb",195:"c4f5d8e4",427:"e7b197f4",489:"e7cdbb73",514:"1be78505",536:"e9d16704",592:"common",651:"8070e160",659:"88aa539f",918:"17896441"}[e]||e)+"."+{1:"de63174f",53:"e3ad223e",195:"25413e05",349:"4c4b6438",427:"31f97feb",489:"e9ada544",514:"cfa83cbf",536:"920ca7fb",592:"aaba9bd1",608:"e7ce046d",651:"6405d015",659:"c03e89b9",918:"7543c8e6"}[e]+".js"},f.miniCssF=function(e){return"assets/css/styles.35f9fda9.css"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="pistache-io:",f.l=function(e,t,n,u){if(r[e])r[e].push(t);else{var i,c;if(void 0!==n)for(var a=document.getElementsByTagName("script"),s=0;s<a.length;s++){var l=a[s];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==o+n){i=l;break}}i||(c=!0,(i=document.createElement("script")).charset="utf-8",i.timeout=120,f.nc&&i.setAttribute("nonce",f.nc),i.setAttribute("data-webpack",o+n),i.src=e),r[e]=[t];var d=function(t,n){i.onerror=i.onload=null,clearTimeout(b);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach((function(e){return e(n)})),t)return t(n)},b=setTimeout(d.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=d.bind(null,i.onerror),i.onload=d.bind(null,i.onload),c&&document.head.appendChild(i)}},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.p="/",f.gca=function(e){return e={17896441:"918",f811e444:"1","935f2afb":"53",c4f5d8e4:"195",e7b197f4:"427",e7cdbb73:"489","1be78505":"514",e9d16704:"536",common:"592","8070e160":"651","88aa539f":"659"}[e]||e,f.p+f.u(e)},function(){var e={303:0,532:0};f.f.j=function(t,n){var r=f.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else if(/^(303|532)$/.test(t))e[t]=0;else{var o=new Promise((function(n,o){r=e[t]=[n,o]}));n.push(r[2]=o);var u=f.p+f.u(t),i=new Error;f.l(u,(function(n){if(f.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),u=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+o+": "+u+")",i.name="ChunkLoadError",i.type=o,i.request=u,r[1](i)}}),"chunk-"+t,t)}},f.O.j=function(t){return 0===e[t]};var t=function(t,n){var r,o,u=n[0],i=n[1],c=n[2],a=0;for(r in i)f.o(i,r)&&(f.m[r]=i[r]);if(c)var s=c(f);for(t&&t(n);a<u.length;a++)o=u[a],f.o(e,o)&&e[o]&&e[o][0](),e[u[a]]=0;return f.O(s)},n=self.webpackChunkpistache_io=self.webpackChunkpistache_io||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}()}();
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -4,14 +4,14 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-beta.1">
<title data-react-helmet="true">REST description | Pistache</title><meta data-react-helmet="true" property="og:url" content="https://pistache.io/docs/rest-description"><meta data-react-helmet="true" name="docusaurus_locale" content="en"><meta data-react-helmet="true" name="docusaurus_version" content="current"><meta data-react-helmet="true" name="docusaurus_tag" content="docs-default-current"><meta data-react-helmet="true" property="og:title" content="REST description | Pistache"><meta data-react-helmet="true" name="description" content="Documentation writing for this part is still in progress, please refer to the restdescription example."><meta data-react-helmet="true" property="og:description" content="Documentation writing for this part is still in progress, please refer to the restdescription example."><link data-react-helmet="true" rel="shortcut icon" href="/img/logo.png"><link data-react-helmet="true" rel="canonical" href="https://pistache.io/docs/rest-description"><link data-react-helmet="true" rel="alternate" href="https://pistache.io/docs/rest-description" hreflang="en"><link data-react-helmet="true" rel="alternate" href="https://pistache.io/docs/rest-description" hreflang="x-default"><link rel="stylesheet" href="/assets/css/styles.35f9fda9.css">
<link rel="preload" href="/assets/js/runtime~main.46269ba1.js" as="script">
<title data-react-helmet="true">REST description | Pistache</title><meta data-react-helmet="true" property="og:url" content="https://pistache.io/docs/rest-description"><meta data-react-helmet="true" name="docusaurus_locale" content="en"><meta data-react-helmet="true" name="docusaurus_version" content="current"><meta data-react-helmet="true" name="docusaurus_tag" content="docs-default-current"><meta data-react-helmet="true" property="og:title" content="REST description | Pistache"><meta data-react-helmet="true" name="description" content="&lt;!--"><meta data-react-helmet="true" property="og:description" content="&lt;!--"><link data-react-helmet="true" rel="shortcut icon" href="/img/logo.png"><link data-react-helmet="true" rel="canonical" href="https://pistache.io/docs/rest-description"><link data-react-helmet="true" rel="alternate" href="https://pistache.io/docs/rest-description" hreflang="en"><link data-react-helmet="true" rel="alternate" href="https://pistache.io/docs/rest-description" hreflang="x-default"><link rel="stylesheet" href="/assets/css/styles.35f9fda9.css">
<link rel="preload" href="/assets/js/runtime~main.53122274.js" as="script">
<link rel="preload" href="/assets/js/main.67d7f0b9.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div><a href="#main" class="skipToContent_1oUP shadow--md">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle clean-btn" type="button" tabindex="0"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><img src="/img/logo.png" alt="Pistache logo" class="themedImage_1VuW themedImage--light_3UqQ navbar__logo"><img src="/img/logo.png" alt="Pistache logo" class="themedImage_1VuW themedImage--dark_hz6m navbar__logo"><b class="navbar__title">Pistache</b></a><a aria-current="page" class="navbar__item navbar__link navbar__link--active" href="/docs/">Docs</a></div><div class="navbar__items navbar__items--right"><a href="https://github.com/pistacheio/pistache" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link header-github-link" aria-label="GitHub repository"></a><div class="react-toggle displayOnlyInLargeViewport_GrZ2 react-toggle--disabled"><div class="react-toggle-track" role="button" tabindex="-1"><div class="react-toggle-track-check"><span class="toggle_71bT">🌜</span></div><div class="react-toggle-track-x"><span class="toggle_71bT">🌞</span></div><div class="react-toggle-thumb"></div></div><input type="checkbox" class="react-toggle-screenreader-only" aria-label="Switch between dark and light mode"></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div><div class="navbar-sidebar"><div class="navbar-sidebar__brand"><a class="navbar__brand" href="/"><img src="/img/logo.png" alt="Pistache logo" class="themedImage_1VuW themedImage--light_3UqQ navbar__logo"><img src="/img/logo.png" alt="Pistache logo" class="themedImage_1VuW themedImage--dark_hz6m navbar__logo"><b class="navbar__title">Pistache</b></a></div><div class="navbar-sidebar__items"><div class="menu"><ul class="menu__list"><li class="menu__list-item"><a aria-current="page" class="menu__link navbar__link--active" href="/docs/">Docs</a></li><li class="menu__list-item"><a href="https://github.com/pistacheio/pistache" target="_blank" rel="noopener noreferrer" class="menu__link header-github-link" aria-label="GitHub repository"></a></li></ul></div></div></div></nav><div class="main-wrapper docs-wrapper doc-page"><div class="docPage_31aa"><aside class="docSidebarContainer_3Kbt"><div class="sidebar_15mo"><nav class="menu menu--responsive thin-scrollbar menu_Bmed" aria-label="Sidebar navigation"><button aria-label="Open menu" aria-haspopup="true" class="button button--secondary button--sm menu__button" type="button"><svg class="sidebarMenuIcon_fgN0" width="24" height="24" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" href="/docs/asynchronous-http-programming">Asynchronous HTTP programming</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/headers">Headers</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/http-handler">HTTP handler</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/">Getting started</a></li><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active active" href="/docs/rest-description">REST description</a></li><li class="menu__list-item"><a class="menu__link" href="/docs/routing">Routing</a></li></ul></nav></div></aside><main class="docMainContainer_3ufF"><div class="container padding-top--md padding-bottom--lg docItemWrapper_3FMP"><div class="row"><div class="col docItemCol_3FnS"><div class="docItemContainer_33ec"><article><div class="markdown"><header><h1 class="h1Heading_27L5">REST description</h1></header><p>Documentation writing for this part is still in progress, please refer to the <a href="https://github.com/pistacheio/pistache/blob/master/examples/rest_description.cc" target="_blank" rel="noopener noreferrer">rest_description</a> example.</p></div><footer class="row docusaurus-mt-lg"><div class="col"><a href="https://github.com/pistacheio/pistache/edit/master/pistache.io/docs/rest-description.md" target="_blank" rel="noreferrer noopener"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_2_ui" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_3DPF"></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/docs/"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">« Getting started</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/docs/routing"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Routing »</div></a></div></nav></div></div><div class="col col--3"><div class="tableOfContents_35-E thin-scrollbar"></div></div></div></div></main></div></div><footer class="footer footer--dark"><div class="container"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Docs</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/">Quickstart</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/http-handler/">User guide</a></li></ul></div><div class="col footer__col"><div class="footer__title">Community</div><ul class="footer__items"><li class="footer__item"><a href="https://stackoverflow.com/questions/tagged/pistache" target="_blank" rel="noopener noreferrer" class="footer__link-item">Stack Overflow</a></li><li class="footer__item"><a href="https://web.libera.chat/#pistache" target="_blank" rel="noopener noreferrer" class="footer__link-item">#pistache on Libera.Chat</a></li></ul></div><div class="col footer__col"><div class="footer__title">More</div><ul class="footer__items"><li class="footer__item"><a href="https://github.com/pistacheio/pistache" target="_blank" rel="noopener noreferrer" class="footer__link-item">GitHub</a></li></ul></div></div><div class="footer__bottom text--center"><div class="footer__copyright">Pistache, 2015 - 2021</div></div></div></footer></div>
<script src="/assets/js/runtime~main.46269ba1.js"></script>
<script src="/assets/js/runtime~main.53122274.js"></script>
<script src="/assets/js/main.67d7f0b9.js"></script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
SPDX-FileCopyrightText: 2016 Mathieu Stefani
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: 2021 Katerina Limpitsouni
SPDX-License-Identifier: LicenseRef-unDraw
SPDX-FileCopyrightText: 2021 Katerina Limpitsouni
SPDX-License-Identifier: LicenseRef-unDraw
SPDX-FileCopyrightText: 2021 Katerina Limpitsouni
SPDX-License-Identifier: LicenseRef-unDraw
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment