更新时间:2023-11-02 GMT+08:00
分享

创建

根据指定的模板在当前工作目录下创建新服务。

  • 在当前工作目录中创建服务:
    serverless create --template-url https://github.com/zy-linn/examples/tree/v3/legacy/huawei-nodejs
  • 使用自定义模板在新文件夹中创建服务:
    serverless create --template-url https://github.com/zy-linn/examples/tree/v3/legacy/huawei-nodejs --path my-service

选项

  • --template-url或-u:指向远程托管模板的URL。如果未指定--template和--template-path,则该选项必填。
  • --template-path:模板的本地路径。如果未指定--template和--template-url,则该选项必填。
  • --path或-p:新建服务所在路径。
  • --name或-n:serverless.yml中服务的名称。

示例

  • 创建新服务
    serverless create --template-url https://github.com/zy-linn/examples/tree/v3/legacy/huawei-nodejs --name my-special-service

    此示例将为服务生成Node.js运行时。华为作为提供商,该运行时将在当前工作目录中生成。

  • 在(新)目录中创建指定名称的服务
    serverless create --template-url https://github.com/zy-linn/examples/tree/v3/legacy/huawei-nodejs --path my-new-service

    此示例将为服务生成Node.js运行时。华为作为提供商,该运行时将在my-new-service目录中生成;如不存在该目录,则会自动生成。在其他情况下Serverless将使用已经存在的目录。

    此外,Serverless将根据您提供的路径将服务重命名。在此示例中,服务将重命名为my-new-service。

分享:

    相关文档

    相关产品