Skip to main content

腾讯云 Serverless

前提准备#

npm install -g serverlessnpm update -g serverless
❯ serverless -vFramework Core: 2.8.0Plugin: 4.1.1SDK: 2.3.2Components: 3.2.7

快速部署#

❯ serverlessServerless: 当前未检测到 Serverless 项目,是否希望新建一个项目? YesServerless: 请选择你希望创建的 Serverless 应用 vue-starter - 快速部署一个 Vue.js 基础应用Serverless: 请输入项目名称 demoServerless: 正在安装 vue-starter 应用...
vue-starter › Created
demo 项目已成功创建!
Serverless: 是否希望立即将该项目部署到云端? Yes
Please scan QR code login from wechat.Wait login...Login successful for TencentCloud.
serverless ⚡frameworkAction: "deploy" - Stage: "dev" - App: "demo" - Instance: "vue-starter"
region:  ap-guangzhouwebsite: https://my-vue-starter-1255876835.cos-website.ap-guangzhou.myqcloud.com
Full details: https://serverless.cloud.tencent.com/apps/demo/vue-starter/dev
Serverless应用已经成功部署,您将享有 30 天免费额度。计费详情:https://url.cn/T1uSQD5C
88s › vue-starter › Success

访问 https://my-vue-starter-1255876835.cos-website.ap-guangzhou.myqcloud.com 查看应用。

查看信息#

❯ cd demo❯ sls info
serverless ⚡framework
Last Action:  deploy (8 minutes ago)Deployments:  1Status:       activeMore Info:    Full details: https://serverless.cloud.tencent.com/apps/demo/vue-starter/dev
region:                ap-guangzhouwebsite:               https://my-vue-starter-1255876835.cos-website.ap-guangzhou.myqcloud.comsourceCodeDownloadUrl: https://sp-ins-prod-1300963013.cos.ap-guangzhou.myqcloud.com/**
vue-starter › Info successfully loaded

开发调试#

sls dev

移除项目#

sls remove

部署 Docusaurus#

创建应用#

npx @docusaurus/init@next init my-site classic

运行:

cd my-siteyarn start

部署应用#

cd my-sitetouch serverless.yml

serverless.yml:

component: websitename: doc-starterapp: demoinputs:  src:    src: ./src    hook: yarn build    dist: ./build  bucketName: my-doc-starter  protocol: https

部署:

serverless

Serverless 控制台#

访问 https://serverless.cloud.tencent.com/ 查看应用: