eidheim / Simple-Web-Server

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.
MIT License
2.62k stars 755 forks source link

Added a parse_query_string() example #162

Closed vitor-alves closed 7 years ago

vitor-alves commented 7 years ago

Hi

I added one more example that uses parse_query_string() to parse the GET request parameters. I think it might be useful for newcomers. It's a pretty common thing to do and I needed it in one of my projects and couldn't find any examples.

The following GET to path /parse with parameters name=Mary and lastName=Smith

localhost:8080/parse?name=Mary&lastName=Smith

will be parsed with parse_query_string() and the name + lastName will be returned as response.

Its similar to the John Smith example, but instead of parsing a JSON the query_string is parsed.

I also fixed a few typos here and there.

Please consider this pull request, and thanks for this project. I have been using it a lot.

eidheim commented 7 years ago

Thank you, I'll look through the changes Today hopefully.

eidheim commented 7 years ago

Thank you again. I pushed this with some changes in https://github.com/eidheim/Simple-Web-Server/commit/b9d4be229f41e3eda72394451d479f5245d2a600.