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

sls-component-http

v1.0.1

Published

快速在腾讯云上部署 `express` 及 `koa` 应用,并可以充分集成 `typescript`,`babel` 等转译工具。本工具基于腾讯云的 [tencent-framework](https://github.com/serverless-components/tencent-framework)

Downloads

1

Readme

Serverless Http Component for Tencent Cloud

快速在腾讯云上部署 expresskoa 应用,并可以充分集成 typescriptbabel 等转译工具。本工具基于腾讯云的 tencent-framework

快速开始

根据我的模板进行创建,这是一个简单结合 koatypescript 的示例。关于本示例使用请移至 tencent-koa-ts

$ serverless install --url https://github.com/shfshanyue/serverless-template-zh/tree/master/tencent-koa-ts --name koa-function

部署到腾讯云

# 部署到腾讯云
$ sls
koa-function [████████████████████████████████████████] 100% | ETA: 0s | Speed: 314.98k/

  koa-app:
    functionName:        koa-function
    functionOutputs:
      ap-guangzhou:
        Name:        koa-function
        Runtime:     Nodejs10.15
        Handler:     http-handler.handler
        MemorySize:  128
        Timeout:     60
        Region:      ap-guangzhou
        Namespace:   default
        Description: This is a function created by serverless component
    region:              ap-guangzhou
    apiGatewayServiceId: service-dture22u
    url:                 https://service-dture22u-1257314149.gz.apigw.tencentcs.com/release/
    cns:                 (empty array)

  11s › koa-app › done

自定义配置

app:
  component: sls-component-http
  inputs:
    region: ap-guangzhou
    functionName: app-demo
    runtime: Nodejs10.15
    functionConf:
      timeout: 60
      memorySize: 128
    apigatewayConf:
      protocols:
        - https
      environment: release

更多配置参见 tencent framework configure

服务器框架

你可以从任意服务器框架中导出 HttpServer 作为入口文件,并在 package.json 中的 main 字段中标明入口文件位置。

因此你可以使用任意的转译工具,如 typescriptbabel,只需要注意在 package.json 中标明编译后入口文件位置。

Koa

const Koa = require('koa')

const app = new Koa()

app.use((ctx) => {
  ctx.body = 'hello, world'
})

module.exports = app

Express

const express = require('express')
const app = express()

// Routes
app.get(`/*`, (req, res) => {
  res.send('hello, world)
})

module.exports = app

注意点

  1. 如入口文件并非 index.js,请在 package.jsonmain 字段标明位置
  2. 严格区分 depdevDep,避免在部署时因为 node_modules 过大而造成速度过慢
  3. 如使用 typescript 等编译工具,请使用 inputs.exclude 排除源文件及编译工具