added some middleware to strip the trailing slash from api requests