In this recipe, we'll see how to make a URL of the form
http://yourserver/path1/path2 accessible to users. This can either be a web page or a path returning arbitrary data to be consumed by other programs. In the latter case, you would usually use the JSON format to consume parameters and to offer your data.
We'll make use of the
library.book model of Chapter 4, Application Models, so in case you haven't done so yet, grab its code to be able to follow the examples.
We want to allow any user to query the full list of books. Furthermore, we want to provide the same information to programs via a JSON request.
We'll need to add controllers, which go into a folder called
controllers by ...