Chapter 3. Developing RESTful Services
Quarkus integrates with RESTEasy, a JAX-RS implementation to define REST APIs. In this chapter, you’ll learn how to develop RESTful web services in Quarkus. We’ll cover the following topics:
How to use JAX-RS for creating CRUD services
How to enable CORS for requesting resources from other domains
How to implement reactive routes
How to implement filters to manipulate requests and responses
3.1 Creating a Simple REST API Endpoint
You want to create a REST API endpoint with CRUD operations.
Use the JAX-RS
GreetingResource resource generated previously and fill it with JAX-RS annotations.
JAX-RS is the default framework used in Quarkus to define REST endpoints.
All of the JAX-RS annotations are already correctly on your classpath.
You will want to use the HTTP verb annotations (
@DELETE) to declare the HTTP verb(s) that the endpoint methods will listen to.
Of course, you will need the
@Path annotation to define the URI relative to the rest of the application for your endpoint.