mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +00:00
Add example POST upload
This commit is contained in:
parent
f002a0d144
commit
9da6da036b
@ -6,7 +6,11 @@
|
||||
"handler": "Email.send",
|
||||
"config": {
|
||||
"policies": [],
|
||||
"description": "Send an email"
|
||||
"description": "Send an email",
|
||||
"tag": {
|
||||
"plugin": "email",
|
||||
"name": "Email"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -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": {
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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());
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user