api-middleware: take options as a map