Created
March 3, 2013 16:20
-
-
Save vinipsmaker/5076728 to your computer and use it in GitHub Desktop.
I love C++11 lambdas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QCoreApplication> | |
#include <Tufao/HttpServer> | |
#include <Tufao/HttpServerRequest> | |
using namespace Tufao; | |
int main(int argc, char *argv[]) | |
{ | |
QCoreApplication a(argc, argv); | |
HttpServer server; | |
QObject::connect(&server, &HttpServer::requestReady, | |
[](HttpServerRequest &req, HttpServerResponse &res) { | |
res.writeHead(200); | |
res << "Hello World\n"; | |
res.end(); | |
}); | |
server.listen(QHostAddress::Any, 8080); | |
return a.exec(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment