January 2018
Intermediate to advanced
414 pages
10h 29m
English
Now, we can improve our mapping by adding request variables that we can use to further understand the request, but first, let's create a new method in our controller to return a list of customers:
@RequestMapping(value = "/customers", method = arrayOf(RequestMethod.GET))fun getCustomers() = customers.map(Map.Entry<Int, Customer>::value).toList()
If we invoke this new URL http://localhost:8080/customers, in our microservice, we will get this result:
[{"id":1,"name":"Kotlin"},{"id":2,"name":"Spring"},{"id":3,"name":"Microservice"}]
We have just transformed our map of customers into a list, and outputted in a new method. But now if we need to filter our customer list, for example, by some part of the customer name, ...
Read now
Unlock full access