上QQ阅读APP看书,第一时间看更新
getAllUsers – mapping
Inside the routingFunction, we will add our first endpoint for getAllUsers. At first, we will keep the null values in the handler to avoid errors in the code:
return nest (
path("/user"),
nest(
accept(MediaType.ALL),
route(GET("/"), null)
)
);
The preceding nest method will be used to route to the right function, and it will also be used to group other routers. In the preceding method, we use /user in our path and we use GET("/") method as a router. Also, we use MediaType.ALL to accept all media ranges to simplify the code.