adding PageRenderer class to extract most of the code of server.js