HTTP routes are the most basic endpoints you can create in Mockoon. They are flexible and can be used to mock any type of API. They support many customizations like headers and body and can have multiple responses and rules to handle different scenarios.
To create a new HTTP route, click on the "HTTP route" entry in the add route menu:
A new route will be created with a default 200 status code and an empty body. You can then customize it to fit your needs.
All HTTP routes are independent of each other and stateless. It means that HTTP routes will not share any data with other routes and that the route will not remember any information between requests. This is important to keep in mind when creating complex APIs with multiple routes.
Some exceptions to this rule are:
HTTP routes can use data buckets to serve data from a shared source and avoid duplication. By selecting "Data bucket" in the route response body type, you can choose a data bucket to serve data from for any of your routes.
However, the data bucket cannot be modified by an HTTP route. Example: an HTTP route with a PUT method won't be able to update a data bucket. It ensures that the data bucket remains a shared source of truth and that the HTTP routes remain stateless.
If you want a data bucket to act as a simple JSON database and be manipulated by your endpoints, you can create CRUD routes that will be able to interact with the data bucket by creating, reading, filtering, updating, and deleting data, in a RESTful way.