Building a uniform interface
Having a uniform interface means that our resources can be uniquely identifiable through a URL. This decouples the backend endpoints and frontend views, enabling our app to scale without clashes between the frontend views and backend endpoints. We have decoupled our backend from the frontend using the version tag. When a URL endpoint includes a version tag, such as v1
or v2
, we know that call is hitting the backend Rust server. When we are developing our Rust server, we might want to work on a newer version of our API calls. However, we do not want to allow users to access the version in development. To enable live users to access one version while we deploy another version on a test server, we will need to dynamically define the API version for the server. With the knowledge that you have acquired so far in this book, you could simply define the version number in the config.yml
file and load it. However, we would have to read the config.yml
config file...