- 创建一个用于上传头像的中间件
- 引入motor包和上级目录file中的file middleware
- 定义文件过滤器aaa_upload_file,使用file future函数设置允许上传的文件类型(如image/png, image/jpeg)
- 创建motor实例avatar_upload,设置选项并指定上传文件保存的路径为upload/app/tr
- 设置文件过滤器为aaa_upload_future
- 使用motor创建文件拦截器中间件,导出eva_interceptor
- eva_interceptor使用motor的single方法允许客户端通过表单字段上传图像文件