use Flask error handler to handle 405 Not Allowed errors to Flask routes
only 405 on FR endpoints
refactor and add comments
update comment