npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

serverless-tencent-scf

v0.1.36

Published

Provider plugin for the Serverless Framework v1.x which adds support for Tencent Cloud Functions.

Downloads

177

Readme

npm version Build Status

Serverless Framework Tencent Cloud Plugin

Quick Start

Complete the steps in this guide to install the Serverless Framework open-source CLI and deploy a sample Service on Tencent Cloud that reports deployment information and operational metrics to the Serverless Framework.

Initial Setup

There are a few prerequisites you need to install and configure:

If you already have these prerequisites setup you can skip ahead to deploy an example Service.

Install Node.js and NPM

  • Follow these installation instructions.
  • At the end, you should be able to run node -v from your command line and get a result like this...
$ node -v
vx.x.x
  • You should also be able to run npm -v from your command line and should see...
$ npm -v
x.x.x

Install the Serverless Framework open-source CLI

  • Run this command in your terminal
npm install -g serverless
  • After install is complete, you should be able to run serverless -v from your command line and get a result like this...
$ serverless -v
x.x.x

Create and deploy a serverless Service

Now that you’ve completed your setup, let’s create and deploy a serverless Service.

Create a new Service from a Template

  1. Use the Serverless Framework open-source CLI to create a new Service with tencent-nodejstemplate.
# Create a new Serverless service/project
$ serverless create --template tencent-nodejs --path my-service

2. Install the dependencies

```sh
# Change into the newly created directory
$ cd my-service
$ npm install

Set up the credentials

Configure your Tencent Cloud account to work with the Serverless Framework.

Set up an endpoint

An Event is anything that can trigger your serverless functions. In this case, you need to define a endpoint in your serverless.yml that will trigger your serverless function.

service: my-service # service name

provider: # provider information
  name: tencent
  runtime: Nodejs8.9
  credentials: ~/credentials

plugins:
  - serverless-tencent-scf

functions:
  function_one:
    handler: index.main_handler
    runtime: Nodejs8.9
    events:
        - apigw:
           name: hello_world_apigw
           parameters:
             stageName: release
             serviceId:
             httpMethod: ANY

Deploy the Service

Use this command to deploy your service for the first time and after you make changes to your Functions, Events or Resources in serverless.yml and want to deploy all changes within your Service at the same time.

serverless deploy

More information in deploy command

Test your Service

Replace the URL in the following curl command with your returned endpoint URL, which you can find in the sls deploy output, to hit your URL endpoint.

$ curl -X POST https://service-xxxx-1300000000.ap-guangzhou.apigateway.myqcloud.com/release/

Invoke your Service's function

Invokes a Function and returns logs.

serverless invoke -f hello

More information in invoke command

Fetch the Function Logs

Open up a separate tab in your console and stream all logs for a specific Function using this command.

serverless logs -f hello -t

Cleanup

Remove your Service

If at any point you no longer need your Service, you can run the following command to remove the Functions, Events and Resources that were created. This will delete the resources you created and ensure that you don't incur any unexpected charges.

serverless remove