Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: New to Casablanck SDKs

$
0
0
Here's a simple one-file example:
#include <iostream>
#include <cpprest/http_listener.h>

using namespace web::http::experimental::listener;
using namespace web::http;

int main()
{
    uri_builder uri(L"http://localhost:2001/");
    http_listener listener(uri.to_uri());

    listener.support(methods::GET, [](http_request req)
    {
        std::cout << "Serving GET" << std::endl;
        req.reply(status_codes::OK, U("<html><body><h1>It works!</h1>(Casablanca, that is.)</body></html>"), U("text/html"));
    });
    
    listener.open().wait();
    fgetc(stdin);
    listener.close().wait();
    return 0;
}

Viewing all articles
Browse latest Browse all 4845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>