我正在尝试使用Azure作为数据存储来为Node和Express制作文件共享应用程序。在Node.js项目中显示Azure子文件夹
我正在努力显示我的容器的子文件夹。
我的代码如下所示:
我创建这样的子文件夹,具有隐藏的意图 - 文件 '$$$ $$$。':
app.post('/folderhandler', function (req, res) { var containerName = req.query.id; var folderName = req.body.folderName; var folder = folderName + '/$$$.$$$'; blobSvc.createBlockBlobFromText( containerName, folder, 'Hello, World!', function (error, result, response) { if (error) { console.log("Couldn't upload string"); console.error(error); } else { console.log('String uploaded successfully'); } }); res.redirect('/container/' + containerName); });
然后我尝试使用新的'Subfolder'作为我的displayBlobs函数中的'容器'变量。但是,这并不工作:
app.get('/container/:containername/:subcontainer', function (req, res) { var containerName = req.params.containername; var subContainer = req.params.subcontainer; blobSvc.listContainersSegmented(null, function (err, containers) { blobSvc.listBlobsSegmented(subContainer, null, function (error, blobs) { res.render('manager.ejs', { error: error, title: 'Manager ' + containerName, pageID: 'containers', containername: subContainer, listContainers: containers.entries, listBlobs: blobs.entries, breadcrumbs: [{ href: '/manager', text: 'Manager' }, { href: '/container/' + containerName, text: containerName }, { text: subContainer, active: true }] }); }); }); });
我想我已经尝试了一切,所以即时通讯开放的建议:)
- 在此先感谢!
你可以编辑你的问题并添加'containerName'和'subContainer'的值吗?也请告诉我们你所看到的(实际行为)以及你期待看到的内容。 –