configure cors middleware and add middleware for json parsing errors