From 181d64223872e4946e1f099e9caa0b3867f18568 Mon Sep 17 00:00:00 2001 From: yhirose Date: Tue, 25 Sep 2012 22:10:19 -0400 Subject: [PATCH] Added 'hello' example. --- .gitignore | 1 + example/Makefile | 9 +++++++-- example/hello.cc | 27 +++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 example/hello.cc diff --git a/.gitignore b/.gitignore index 8a3a99c..036ad16 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ tags sample +hello *.swp diff --git a/example/Makefile b/example/Makefile index cd63b38..dd48b71 100644 --- a/example/Makefile +++ b/example/Makefile @@ -3,15 +3,20 @@ USE_CLANG = 1 ifdef USE_CLANG CC = clang++ -CFLAGS = -std=c++0x -stdlib=libc++ +CFLAGS = -std=c++0x -stdlib=libc++ -g else CC = g++ -CFLAGS = -std=c++11 +CFLAGS = -std=c++11 -g endif +all: sample hello + sample : sample.cc ../httpsvrkit.h $(CC) -o sample $(CFLAGS) -I.. sample.cc +hello : hello.cc ../httpsvrkit.h + $(CC) -o hello $(CFLAGS) -I.. hello.cc + .PHONY : test test: sample ./sample diff --git a/example/hello.cc b/example/hello.cc new file mode 100644 index 0000000..54c5ce3 --- /dev/null +++ b/example/hello.cc @@ -0,0 +1,27 @@ +// +// hello.cc +// +// Copyright (c) 2012 Yuji Hirose. All rights reserved. +// The Boost Software License 1.0 +// + +#include + +int main(void) +{ + HTTP_SERVER("localhost", 1234) { + + // const httpsvrkit::Request& req + // httpsvrkit::Response& res + + GET("/hello", { + res.set_content("world"); + }); + + GET("/url", { + res.set_content(req.url); + }); + } +} + +// vim: et ts=4 sw=4 cin cino={1s ff=unix