Skip to content

Instantly share code, notes, and snippets.

@vinipsmaker
Created March 3, 2013 16:20
Show Gist options
  • Save vinipsmaker/5076728 to your computer and use it in GitHub Desktop.
Save vinipsmaker/5076728 to your computer and use it in GitHub Desktop.
I love C++11 lambdas
#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