Changed app layout and middleware to pass to next() if matching fails, and to allow /api endpoint to trigger