FlixTube 部署全流程指南
1. 视频上传至 Azure Storage
以下是将视频从 HTTP POST 请求流式传输到 Azure Storage 的代码:
app.post("/upload", async (req, res) => {
const videoId = req.headers.id;
const contentType = req.headers["content-type"];
const blobService = createBlobService();
const containerClient =
blobService.getContainerClient(STORAGE_CONTAINER_NAME);
await containerClient.createIfNotExists();
const blockBlobClient = containerClient.getBlockBlobClient(videoId);
await blockBlobClient.uploadStream(req);
await blockBlobClient.setHTTPHeaders({
blobContentType: contentType
});
res.sendStatus(200);
});
此代码的工作流程如下:
1. 提取视频详情 :从请求头中提取视频 ID 和内容类型。
2. 创建存储容
超级会员免费看
订阅专栏 解锁全文
57

被折叠的 条评论
为什么被折叠?



