Home Computer Science Building Applications with Scala
Configuring new routes
We need to add the following three new routes for our REST API, which is located at
# REST API
controllers.RestAPIController.listAllProducts GET /REST/api/review/all
GET /REST/api/image/all controllers.RestAPIController.listAllImages
As you can see, we mapped all the list operations we just created.
Testing the API using the browser
Now we can run $ activator run and test our new REST API using our web browser. Go to http://localhost:9000/REST/api/product/all; you should see something similar to the following screenshot:
Let's look at the review API.
Go to http://localhost:9000/REST/api/review/all; you should see results similar to the following screenshot:
Finally, let's check out the image of REST API.
Go to http://localhost:9000/REST/api/image/all; you should see results similar to the following screenshot:
OK. Now we will continue to work with REST. We just finished the server; however, it is important to create a REST client to consume these REST APIs.
|< Prev||CONTENTS||Next >|