This work was done during one of the XQuery Basics Classes where customers asked for a demonstration of REST. None of the files was renamed and no code changes were needed to use rewrite.
It does a lazy loading of files, so they will be loaded the first time you call the application.
Simple create an HTTP App Server pointing to this directory and make rewrite.xqy the rewrite script for that App Server.
Added a route to access countries by name, e.g. http://localhost/country/Argentina for demonstration purposes. It's not linked in the application but you can access it directly by URL.
This application was developed as part of MarkLogic University. If you want to learn how it was built register in the XQuery Basics class. This is copyrighted by MarkLogic University and ok to use only for the purposes of this demonstration. Further inquiries can be sent to training at marklogic dot com.