国产成人精品无码青草_亚洲国产美女精品久久久久∴_欧美人与鲁交大毛片免费_国产果冻豆传媒麻婆精东

15158846557 在線咨詢 在線咨詢
15158846557 在線咨詢
所在位置: 首頁 > 營銷資訊 > 網(wǎng)站運營 > 用 Serverless 搭建個人靜態(tài)相冊網(wǎng)站

用 Serverless 搭建個人靜態(tài)相冊網(wǎng)站

時間:2023-05-31 12:03:01 | 來源:網(wǎng)站運營

時間:2023-05-31 12:03:01 來源:網(wǎng)站運營

用 Serverless 搭建個人靜態(tài)相冊網(wǎng)站:日常生活中我們經(jīng)常會拍攝一些視頻、照片等,這些文件會占用比較多的存儲空間。本文將介紹一種方法:利用 ThumbsUp 工具,結(jié)合 Serverless Framework 的 component 快速搭建個人相冊網(wǎng)站,為存儲空間減壓。

工具介紹:

整個網(wǎng)站的搭建部署只需三步:安裝與初始化 → 配置 yml 文件 → 部署。

用 Serverless 搭建個人相冊網(wǎng)站https://www.zhihu.com/video/1208836527276965888

安裝與初始化

首先確保系統(tǒng)包含以下環(huán)境:

如未安裝上述應(yīng)用程序,可以參考安裝說明。

1. 安裝 Serverless Framework

$ npm install -g serverless2. 安裝 ThumbsUp

$ npm install -g thumbsup3. 初始化項目

$ mkdir photos$ thumbsup --input ./photos/ --output website初始化成功后,可以看到項目目錄結(jié)構(gòu):

.├── photos└── website └── index.html

配置 yml 文件

項目目錄下,創(chuàng)建 serverless.yml 文件

touch serverless.yml將以下內(nèi)容寫入上述的 yml 文件里:

# serverless.ymlmyWebsite: component: "@serverless/tencent-website" inputs: code: src: ./website index: index.html error: index.html region: ap-guangzhou bucketName: my-bucket-1111配置完成后,文件目錄如下:

.├── photos├── website| └── index.html└── serverless.yml

部署

通過 sls 命令進行部署,并可以添加 --debug 參數(shù)查看部署過程中的信息

如您的賬號未登陸或注冊騰訊云,您可以直接通過微信掃描命令行中的二維碼進行授權(quán)登陸和注冊。

sls --debug DEBUG ─ Resolving the template's static variables. DEBUG ─ Collecting components from the template. DEBUG ─ Downloading any NPM components found in the template. DEBUG ─ Analyzing the template's components dependencies. DEBUG ─ Creating the template's components graph. DEBUG ─ Syncing template state. DEBUG ─ Executing the template's components graph. DEBUG ─ Starting Website Component. DEBUG ─ Preparing website Tencent COS bucket my-bucket-thumbsup-1256386184. DEBUG ─ Deploying "my-bucket-thumbsup-1256386184" bucket in the "ap-guangzhou" region. DEBUG ─ "my-bucket-thumbsup-1256386184" bucket was successfully deployed to the "ap-guangzhou" region. DEBUG ─ Setting ACL for "my-bucket-thumbsup-1256386184" bucket in the "ap-guangzhou" region. DEBUG ─ Ensuring no CORS are set for "my-bucket-thumbsup-1256386184" bucket in the "ap-guangzhou" region. DEBUG ─ Ensuring no Tags are set for "my-bucket-thumbsup-1256386184" bucket in the "ap-guangzhou" region. DEBUG ─ Configuring bucket my-bucket-thumbsup-1256386184 for website hosting. DEBUG ─ Uploading website files from D:/tencent-serverless/thumbsup/website to bucket my-bucket-thumbsup-1256386184. DEBUG ─ Starting upload to bucket my-bucket-thumbsup-1256386184 in region ap-guangzhou DEBUG ─ Uploading directory D:/tencent-serverless/thumbsup/website to bucket my-bucket-thumbsup-1256386184 DEBUG ─ Website deployed successfully to URL: http://my-bucket-thumbsup-1256386184.cos-website.ap-guangzhou.myqcloud.com. myWebsite: url: http://my-bucket-thumbsup-1256386184.cos-website.ap-guangzhou.myqcloud.com env: 13s ? myWebsite ? done訪問命令行輸出的 website url,即可查看即可查看使用 Serverless Framework 部署的照片墻網(wǎng)站。

注:如果希望更新網(wǎng)站中的照片或者視頻等文件,可以在 photos 文件夾更新照片后,在本地重新運行 thumbsup --input ./photos/ --output website 更新本地頁面,再運行 sls 即可更新網(wǎng)站。

小結(jié)

本文使用了非常流行的無服務(wù)器框架 Serverless Framework 來搭建照片墻網(wǎng)站,更多產(chǎn)品信息可以點擊進入 官網(wǎng) 學(xué)習(xí)。

傳送門:
歡迎訪問:Serverless 中文網(wǎng),您可以在 最佳實踐 里體驗更多關(guān)于 Serverless 應(yīng)用的開發(fā)!



關(guān)鍵詞:靜態(tài),相冊

74
73
25
news

版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。

為了最佳展示效果,本站不支持IE9及以下版本的瀏覽器,建議您使用谷歌Chrome瀏覽器。 點擊下載Chrome瀏覽器
關(guān)閉