add api middleware for resource action handlers