Added some basic logging to the console. Made the compilation of the page scripts part of the construction of the middleware.