Categories
express node.js swagger

How to upload file using swagger-express-mw and express?

I want to upload multipart form-data using express framework. I’m using swagger-node with express for my APIs. Now, I’ve written the following in swagger YAML file to upload file:

  /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"

But now I don’t know how to upload image using it. Is there any inbuilt facility to upload image in swagger?