Declaring API endpoints and managing the errors
An endpoint is an interface that your server exposes to the outside, and every client with the coordinates of the route can call it to execute the application’s business logic.
Fastify lets you use the software architecture you like most. In fact, this framework doesn’t limit you from adopting Representation State Transfer (REST), GraphQL, or simple Application Programming Interfaces (APIs). The first two architectures standardize the following:
- The application endpoints: The standard shows you how to expose your business logic by defining a set of routes
- The server communication: This provides insights into how you should define the input/output
In this chapter, we will create simple API endpoints with JSON input/output interfaces. This means that we have the freedom to define an internal standard for our application; this choice will let us focus on using the Fastify framework instead of following...