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

New Post: Hello World with C++ REST SDK

$
0
0
Hello, I am trying make a hello world program wich prints in a web browser the message "Hello World" but I'm not understand how to do this. Someone can help me?

I'm try make a server, when I open the URL in web browser, the server will respond with the message. The code I used was for the server is:
#include "stdafx.h"
#include <cpprest\http_client.h>
#include<cpprest\http_listener.h>
#include <iostream>

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

int main(int argc, char* argv[]){
    http_listener listener(U("http://localhost:1234/"));
    listener.open().wait();
    listener.support(methods::GET, [](http_request request){
        request.reply(http::status_codes::OK, U("Hello World!"));
    });
    listener.close();
    return 0;
}

Viewing all articles
Browse latest Browse all 4845

Latest Images

Trending Articles



Latest Images

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