@@ -17,7 +17,7 @@ int main() {
1717
1818 // Add resources using regular expression for path, a method-string, and an anonymous function
1919 // POST-example for the path /string, responds the posted string
20- server.resources [" ^/string/?$" ][" POST" ]=[](ostream& response, Request& request) {
20+ server.resource [" ^/string/?$" ][" POST" ]=[](ostream& response, Request& request) {
2121 // Retrieve string from istream (*request.content)
2222 stringstream ss;
2323 *request.content >> ss.rdbuf ();
@@ -34,7 +34,7 @@ int main() {
3434 // "lastName": "Smith",
3535 // "age": 25
3636 // }
37- server.resources [" ^/json/?$" ][" POST" ]=[](ostream& response, Request& request) {
37+ server.resource [" ^/json/?$" ][" POST" ]=[](ostream& response, Request& request) {
3838 try {
3939 ptree pt;
4040 read_json (*request.content , pt);
@@ -50,7 +50,7 @@ int main() {
5050
5151 // GET-example for the path /info
5252 // Responds with request-information
53- server.resources [" ^/info/?$" ][" GET" ]=[](ostream& response, Request& request) {
53+ server.resource [" ^/info/?$" ][" GET" ]=[](ostream& response, Request& request) {
5454 stringstream content_stream;
5555 content_stream << " <h1>Request:</h1>" ;
5656 content_stream << request.method << " " << request.path << " HTTP/" << request.http_version << " <br>" ;
@@ -66,7 +66,7 @@ int main() {
6666
6767 // GET-example for the path /match/[number], responds with the matched string in path (number)
6868 // For instance a request GET /match/123 will receive: 123
69- server.resources [" ^/match/([0-9]+)/?$" ][" GET" ]=[](ostream& response, Request& request) {
69+ server.resource [" ^/match/([0-9]+)/?$" ][" GET" ]=[](ostream& response, Request& request) {
7070 string number=request.path_match [1 ];
7171 response << " HTTP/1.1 200 OK\r\n Content-Length: " << number.length () << " \r\n\r\n " << number;
7272 };
0 commit comments