Added single page app middleware