1
0
mirror of synced 2025-04-20 11:47:43 +03:00
cpp-httplib/example/sample.cc
2012-09-25 23:21:57 -04:00

34 lines
551 B
C++

//
// sample.cc
//
// Copyright (c) 2012 Yuji Hirose. All rights reserved.
// The Boost Software License 1.0
//
#include <httpsvrkit.h>
#include <cstdio>
using namespace httpsvrkit;
int main(void)
{
const char* hi = "/hi";
HTTP_SERVER("localhost", 1234) {
GET("/", {
res.set_redirect(hi);
});
GET("/hi", {
res.set_content("Hello World!");
});
GET("/dump", {
res.set_content(dump_request(cxt));
});
}
}
// vim: et ts=4 sw=4 cin cino={1s ff=unix