我已经声明了我的数据源、我的模型以及它们之间的连接器。
我的模型
{
"name": "container",
"base": "Model",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
}
数据源
"storage": {
"name": "storage",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./server/storage"
}
我的提供商
{
"filesystem": {
"root": "./server/storage"
}
}
和连接器
"container": {
"dataSource": "storage",
"public": true
}
我尝试将像 {"Object":"container1"} 这样的对象发布到路径“./server/storage”中,但我从回调中收到以下错误。
{
"error": {
"statusCode": 500,
"name": "TypeError",
"message": "Path must be a string. Received undefined",
"stack": "TypeError: Path must be a string. Received undefined.."
}
}
请问谁能帮我解决我的问题?谢谢!
最佳答案
您还可以使用“名称”而不是“对象”作为 JSON 对象中的键,以使用 API 创建新的容器/目录。
POST/api/containers {"name":"container1"}
关于javascript - 如何从环回在 Storage api 中发布容器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45014032/