mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-10 09:43:51 +00:00
Added the hello world sample to README.md.
This commit is contained in:
parent
181d642238
commit
bad43c66d7
17
README.md
17
README.md
@ -1,6 +1,21 @@
|
|||||||
httpsvrkit
|
httpsvrkit
|
||||||
==========
|
==========
|
||||||
|
|
||||||
C++ HTTP sever library
|
C++ HTTP sever library inspired by [Sinatra](http://www.sinatrarb.com/)
|
||||||
|
|
||||||
[The Boost Software License 1.0](http://www.boost.org/LICENSE_1_0.txt)
|
[The Boost Software License 1.0](http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
|
#include <httpsvrkit.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
HTTP_SERVER("localhost", 1234) {
|
||||||
|
GET("/hi", {
|
||||||
|
res.set_content("Hello World!");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Copyright (c) 2012 Yuji Hirose. All rights reserved.
|
||||||
|
@ -10,16 +10,8 @@
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
HTTP_SERVER("localhost", 1234) {
|
HTTP_SERVER("localhost", 1234) {
|
||||||
|
GET("/hi", {
|
||||||
// const httpsvrkit::Request& req
|
res.set_content("Hello World!");
|
||||||
// httpsvrkit::Response& res
|
|
||||||
|
|
||||||
GET("/hello", {
|
|
||||||
res.set_content("world");
|
|
||||||
});
|
|
||||||
|
|
||||||
GET("/url", {
|
|
||||||
res.set_content(req.url);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user