From the course: Web Servers and APIs using C++

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Reading the query string

Reading the query string - C++ Tutorial

From the course: Web Servers and APIs using C++

Start my 1-month free trial

Reading the query string

- [Narrator] Query strings are the part of the URL that comes after the question mark. They're never used to determine a route handler, but since they are related, let's see how to parse them in Crow. To access the query string, you'll need the request object. So, let's go ahead and just build a very simple handler to test this out, and so we're gonna say crow underscore route. and we have an app. The name of our handler is going to be forward-slash query, and we are going to have nothing in our lambda capture. Inside of our parameters list, we're gonna take the... Let's go ahead and just grab them from up here... The request and response objects, so paste those right there, and then we have an open and close in curly braces. The semicolon, we're gonna open that up, and what we're gonna do, is we're gonna say auto first name equals R-E-Q for the request, U-R-L underscore param, and that's with an S, params. And then we're gonna call the get method, and say first name, and we're gonna…

Contents