小编use*_*.14的帖子

如何使用 swagger-express-mw 和 express 上传文件?

我想使用快速框架上传多部分表单数据。我正在为我的 API使用带有 express 的swagger-node。现在,我在 swagger YAML 文件中编写了以下内容以上传文件:

  /picture/students:
    # binds a127 app logic to a route
    x-swagger-router-controller: bus_api
    post:
      description: Upload a picture
      # used as the method name of the controller
      operationId: uploadStudentPic
      consumes:
        - multipart/form-data
      parameters:
       - in: formData
         name: imageFile
         type: file
         description: The file to upload.
         required: true
      responses:
        "200":
          description: OK
          schema:
            # a pointer to a definition
            $ref: "#/definitions/SuccessResponseStr"
Run Code Online (Sandbox Code Playgroud)

但现在我不知道如何使用它上传图片。是否有任何内置工具可以在 swagger 中上传图像?

node.js express swagger

6
推荐指数
1
解决办法
1343
查看次数

标签 统计

express ×1

node.js ×1

swagger ×1