separating 404 logic from views server middleware