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

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Creating an endpoint

Creating an endpoint

- [Instructor] Even though it isn't explicitly stated, the routes in crow only handle the GET method by default. This makes sense since it is the most-used method. It is the one issued by the browser when you type in a URL. If you wish to write a RESTful API, you'll need to know how to write route handlers for the other HTTP methods. In order to test the code in this section, you will need software which can issue requests using other HTTP methods. I am going to use the free Restlet Client Chrome extension. But there are others available and many are also free. Adding support for other HTTP methods is relatively straightforward, but remember one important thing. There can only be one handler for each route period. So if you want to handle more than one method on a single route, they will have to share it. Let's see how this is done. Let's go back into Atom. Just ahead of our route route, we're gonna create a new…

Contents