Routing is a very important feature of any web application. It is the interface through which you can access the application and perform certain actions on it. HTTP is the protocol used in routing. We went through the basics of HTTP in Chapter 1, Getting Started with Server Swift, and as you might be aware, HTTP protocol requires a method, a path, a set of headers, and an optional body to make a request to the server. The server then responds back with a message that contains a status code, a set of Response headers, and a message body.
Routing in Vapor
HTTP methods
For most of the web, there are five commonly used HTTP methods, which are as follows:
- GET
- POST
- PATCH
- PUT
- DELETE
- OPTIONS
There are also other methods that...