littlebus
littlebus

Reputation: 11

loopback upload file by storage component

I try to build a server by loopback, which can upload and download files. But when I was reading docs, I followed its steps, but couldn't understand some descriptions. Storage component REST API. I can't understand "Arguments Container specification in POST body." Then fail in uploading and downloading. I'm not familiar with javascript and start learning node.js for only one week.

Upvotes: 0

Views: 615

Answers (1)

nidhin
nidhin

Reputation: 439

http://loopback.io/doc/en/lb2/Storage-component.html

follow this docs. Here container is the folder name. After Following the steps in the docs then create a folder inside server called storage and create a model named container using slc cli. Then check it from explore you can see the file handling routes inside container section of the explorer. Use the below code to configure the model inside datasource.json

"imagestorage": {
"name": "imagestorage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./server/storage"

}

cannot forget to specify your on location in root

Upvotes: 1

Related Questions