Add example POST upload

This commit is contained in:
Aurelsicoko 2018-09-20 11:40:37 +02:00
parent f002a0d144
commit 9da6da036b
4 changed files with 105 additions and 2 deletions

View File

@ -6,7 +6,11 @@
"handler": "Email.send",
"config": {
"policies": [],
"description": "Send an email"
"description": "Send an email",
"tag": {
"plugin": "email",
"name": "Email"
}
}
},
{

View File

@ -1,5 +1,103 @@
{
"paths": {
"/upload/": {
"post": {
"description": "Upload one or multiple files",
"responses": {
"200": {
"description": "response",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"hash": {
"type": "string",
"format": "uuid"
},
"sha256": {
"type": "string"
},
"ext": {
"type": "string"
},
"mime": {
"type": "string"
},
"size": {
"type": "integer"
},
"url": {
"type": "string",
"format": "uri"
},
"provider": {
"type": "string"
},
"related": {
"type": "array",
"items": {
"type": "object"
}
}
}
}
}
}
}
}
},
"summary": "",
"tags": [
"Upload - File"
],
"requestBody": {
"description": "",
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"required": ["files"],
"properties": {
"files": {
"type": "array",
"items": {
"type": "string",
"format": "binary"
}
},
"path": {
"type": "string",
"example": "/public/upload"
},
"refId": {
"type": "string",
"example": "5a993616b8e66660e8baf45c"
},
"ref": {
"type": "string",
"example": "user"
},
"source": {
"type": "string",
"example": "users-permissions"
},
"field": {
"type": "string",
"example": "avatar"
}
}
}
}
}
}
}
},
"/upload/files/count": {
"get": {
"responses": {

View File

@ -37,6 +37,7 @@ module.exports = async function() {
}
this.middleware[middleware].loaded = true;
console.log('middleware:' + middleware + ':loaded');
this.emit('middleware:' + middleware + ':loaded');
// Remove listeners.
this.removeAllListeners('middleware:' + middleware + ':loaded');

View File

@ -74,7 +74,7 @@ module.exports = strapi => {
strapi.app.use(router.middleware());
});
}
// Let the router use our routes and allowed methods.
strapi.app.use(strapi.router.middleware());