open-index/open-npm huggingface dataset:
npm package: @serverless/tencent-flask
Description: Tencent Cloud Flask Serverless Component
Author: Tencent Cloud, Inc.
Latest version: 1.0.1

[![Serverless Python Flask Tencent Cloud](https://img.serverlesscloud.cn/20191226/1577347052683-flask_%E9%95%BF.png)](http://serverless.com)

# Tencent Flask Serverless Component

[简体中文](https://github.com/serverless-components/tencent-flask/blob/master/README.md) | English

## Introduction

Tencent [Flask](https://github.com/pallets/flask) Serverless Component, support Restful API deploy, not supportting Flask command.

## Content

1. [Prepare](#0-prepare)
1. [Install](#1-install)
1. [Create](#2-create)
1. [Configure](#3-configure)
1. [Deploy](#4-deploy)
1. [Remove](#5-Remove)

### 0. Prepare

Before using this component, you need create a flask project, then add `Flask` and `werkzeug` in `requirements.txt`. Like below:

```txt
Flask==1.0.2
werkzeug==0.16.0
```

Then create your API service entry file `app.py`, below is a example:

```python
from flask import Flask, jsonify
app = Flask(__name__)

@app.route("/")
def index():
    return "Hello Flash"

@app.route("/users")
def users():
    users = [{'name': 'test1'}, {'name': 'test2'}]
    return jsonify(data=users)

@app.route("/users/<id>")
def user(id):
    return jsonify(data={'name': 'test1'})
```

### 1. Install

Install the Serverless Framework globally:

```shell
$ npm install -g serverless
```

### 2. Create

Just create the following simple boilerplate:

```shell
$ touch serverless.yml
$ touch .env           # your Tencent api keys
```

Add the access keys of a [Tencent CAM Role](https://console.cloud.tencent.com/cam/capi) with `AdministratorAccess` in the `.env` file, using this format:

```
# .env
TENCENT_SECRET_ID=XXX
TENCENT_SECRET_KEY=XXX
```

- If you don't have a Tencent Cloud account, you could [sign up](https://intl.cloud.tencent.com/register) first.

### 3. Configure

```yml
# serverless.yml

MyComponent:
  component: '@serverless/tencent-flask'
  inputs:
    region: ap-guangzhou
    functionName: flask-function
    code: ./
    functionConf:
      timeout: 10
      memorySize: 128
      environment:
        variables:
          TEST: vale
      vpcConfig:
        subnetId: ''
        vpcId: ''
    apigatewayConf:
      protocol: https
      environment: release
```

- [More Options](https://github.com/serverless-components/tencent-flask/blob/master/docs/configure.md)

### 4. Deploy

```shell
$ sls --debug
```

&nbsp;

### 5. Remove

```shell
$ sls remove --debug
```

### More Components

Checkout the [Serverless Components](https://github.com/serverless/components) repo for more information.
npm package: @serverless/tencent-layer
Description: Tencent Cloud Layer Component
Author: Tencent Cloud, Inc.
Latest version: 0.1.7

# Tencent Cloud Layer Component

[![npm](https://img.shields.io/npm/v/%40serverless%2Ftencent-layer)](http://www.npmtrends.com/%40serverless%2Ftencent-layer)
[![NPM downloads](http://img.shields.io/npm/dm/%40serverless%2Ftencent-layer.svg?style=flat-square)](http://www.npmtrends.com/%40serverless%2Ftencent-layer)

[简体中文](https://github.com/serverless-components/tencent-layer/blob/master/README.md) | English

## Introduction

Tencent Cloud Layer serverless component.

## Content

1. [Install](#1-install)
2. [Create](#2-create)
3. [Configure](#3-configure)
4. [Deploy](#4-deploy)
5. [Remove](#5-Remove)

### 1. Install

Install the Serverless Framework globally:

```bash
$ npm install -g serverless
```

### 2. Create

In project root, create the following simple boilerplate:

```bash
$ touch serverless.yml
$ touch .env           # your Tencent api keys
```

Add the access keys of a [Tencent CAM Role](https://console.cloud.tencent.com/cam/capi) with `AdministratorAccess` in the `.env` file, using this format:

```
# .env
TENCENT_SECRET_ID=XXX
TENCENT_SECRET_KEY=XXX
```

- If you don't have a Tencent Cloud account, you could [sign up](https://intl.cloud.tencent.com/register) first.

### 3. Configure

```yml
# serverless.yml
MyLayer:
  component: '@serverless/tencent-layer'
  inputs:
    region: ap-guangzhou
    name: test
    src: ./node_modules
    runtimes:
      - Nodejs8.9
    description: test project layer
```

- [More Options](https://github.com/serverless-components/tencent-layer/blob/master/docs/configure.md)

### 4. Deploy

```bash
$ 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 ─ Compressing layer test file to /Users/yugasun/Desktop/Develop/serverless/tencent-layer/example/.serverless/test-layer.zip.
  DEBUG ─ Compressed layer test file successful
  DEBUG ─ Uploading layer package to cos[sls-cloudlayer-ap-guangzhou-layer]. sls-cloudlayer-test-1583823859.zip
  DEBUG ─ Creating layer test
  DEBUG ─ Created layer: test, version: 7 successful

  MyLayer:
    region:      ap-guangzhou
    name:        test
    description: test project layer
    runtimes:
      - Nodejs8.9
    licenseInfo:
    hash:        d41cdf04bd33315be0d87e8562de9dd8
    version:     7

  12s › MyLayer › done
```

> Notice: `sls` is short for `serverless` command.

&nbsp;

### 5. Remove

```bash
$ sls remove --debug

  DEBUG ─ Flushing template state and removing all components.
  DEBUG ─ Start removing layer: test, version: 7...
  DEBUG ─ Remove layer: test, version: 7 successfully

  6s › MyLayer › done
```

### More Components

Checkout the [Serverless Components](https://github.com/serverless/components) repo for more information.
npm package: @serverless/tencent-postgresql
Description: Tencent Cloud PostgresSQL Component
Author: Tencent Cloud, Inc.
Latest version: 0.1.3

# Tencent Cloud PostgreSQL Component

[简体中文](https://github.com/serverless-components/tencent-postgresql/blob/master/README.md) | English

## Introduction

Using PostgreSQL Component, you can create/update/delete PostgreSQL Instance for Serverless Application conveniently.

## Content

1. [Install](#1-install)
2. [Create](#2-create)
3. [Configure](#3-configure)
4. [Deploy](#4-deploy)
5. [Remove](#5-Remove)

### 1. Install

Install the Serverless Framework globally:

```bash
$ npm install -g serverless
```

### 2. Create

In project root, create the following simple boilerplate:

```bash
$ touch serverless.yml
$ touch .env           # your Tencent api keys
```

Add the access keys of a [Tencent CAM Role](https://console.cloud.tencent.com/cam/capi) with `AdministratorAccess` in the `.env` file, using this format:

```
# .env
TENCENT_SECRET_ID=XXX
TENCENT_SECRET_KEY=XXX
```

- If you don't have a Tencent Cloud account, you could [sign up](https://intl.cloud.tencent.com/register) first.

### 3. Configure

```yml
# serverless.yml
MyPostgreSQL:
  component: '@serverless/tencent-postgresql'
  inputs:
    region: ap-guangzhou
    zone: ap-guangzhou-3
    dBInstanceName: serverlessDb
    dBVersion: 10.4
    dBCharset: UTF8
    vpcConfig:
      vpcId: 123
      subnetId: 123
    extranetAccess: false
```

- [More Options](https://github.com/serverless-components/tencent-postgresql/blob/master/docs/configure.md)

### 4. Deploy

```bash
$ sls --debug
```

> Notice: `sls` is short for `serverless` command.

&nbsp;

### 5. Remove

```bash
$ sls remove --debug
```

### More Components

Checkout the [Serverless Components](https://github.com/serverless/components) repo for more information.
npm package: @serverless/tencent-pyramid
Description: Tencent Cloud Python Pyramid Serverless Component
Author: Dfounderliu
Latest version: 1.0.1

[![Serverless Pyramid Tencent Cloud](https://img.serverlesscloud.cn/2020227/1582799581629-pyramid_%E9%95%BF.png)](http://serverless.com)

&nbsp;

# 腾讯云 Pyramid Serverless Component

## 简介

腾讯云 Pyramid Serverless Component, 支持 Restful API 服务的部署.

## 目录

0. [准备](#0-准备)
1. [安装](#1-安装)
1. [配置](#2-配置)
1. [部署](#3-部署)
1. [移除](#4-移除)

### 0. 准备 `

安装Pyramid，新建python文件，例如`app.py`：

```pyyhon
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response


def hello_world(request):
    return Response('Hello World!')


with Configurator() as config:
    config.add_route('hello', '/')
    config.add_view(hello_world, route_name='hello')
    app = config.make_wsgi_app()
    
if __name__ == "__main__":
    server = make_server('0.0.0.0', 6543, app)
    server.serve_forever()
```

并将python所需要的依赖安装到项目目录，例如本实例需要`Pyramid`，所以可以通过`pip`进行安装：

```
pip install Pyramid -t ./
```

如果因为网络问题，可以考虑使用国内源，例如：

```
pip install Pyramid -t ./ -i https://pypi.tuna.tsinghua.edu.cn/simple
```

### 1. 安装

通过 npm 全局安装 [serverless cli](https://github.com/serverless/serverless)

```shell
$ npm install -g serverless
```

### 2. 配置

本地创建 `serverless.yml` 文件，在其中进行如下配置

```shell
$ touch serverless.yml
```

```yml
PyramidTest:
  component: '@serverless/tencent-pyramid'
  inputs:
    region: ap-guangzhou
    functionName: PyramidFunctionTest
    pyramidProjectName: myPyramid
    code: ./
    functionConf:
      timeout: 10
      memorySize: 256
      environment:
        variables:
          TEST: vale
      vpcConfig:
        subnetId: ''
        vpcId: ''
    apigatewayConf:
      protocols:
        - http
      environment: release

```

注意，这里的pyramidProjectName必须要和你的项目名称一致！

这里要额外说明，`pyramidProjectName`实际上是包括你app的那个文件即`app = config.make_wsgi_app()`，并且要确保可以通过`文件名.app`从外引用该文件。

- [更多配置](docs/configure.md)

### 3. 部署

如您的账号未 [登陆](https://cloud.tencent.com/login) 或 [注册](https://cloud.tencent.com/register) 腾讯云，您可以直接通过 `微信` 扫描命令行中的二维码进行授权登陆和注册。

通过 `sls` 命令进行部署，并可以添加 `--debug` 参数查看部署过程中的信息

```shell
$ sls --debug
```

### 4. 移除

通过以下命令移除部署的服务

```shell
$ sls remove --debug
```

### 账号配置（可选）

当前默认支持 CLI 扫描二维码登录，如您希望配置持久的环境变量/秘钥信息，也可以本地创建 `.env` 文件

```shell
$ touch .env # 腾讯云的配置信息
```

在 `.env` 文件中配置腾讯云的 SecretId 和 SecretKey 信息并保存

如果没有腾讯云账号，可以在此 [注册新账号](https://cloud.tencent.com/register)。

如果已有腾讯云账号，可以在 [API 密钥管理](https://console.cloud.tencent.com/cam/capi) 中获取 `SecretId` 和`SecretKey`.

```text
# .env
TENCENT_SECRET_ID=123
TENCENT_SECRET_KEY=123
```