GithubHelp home page GithubHelp logo

justjavac / deno_serverless_aliyun Goto Github PK

View Code? Open in Web Editor NEW
60.0 3.0 1.0 40 KB

为阿里云 serverless 平台添加 Deno Runtime

License: MIT License

TypeScript 100.00%
deno deno-module aliyun aliyun-fc serverless serverless-functions

deno_serverless_aliyun's Introduction

deno_serverless_aliyun

Deno + Serverless = Awesome

背景

目前阿里云的函数计算服务只支持 Nodejs、Python、PHP、Java、.Net。本项目使用阿里云的 custom runtime 功能开发了可运行 Deno 的 Serverless 环境。

使用

首先安装官方命令行工具 Serverless Devs:

npm install @serverless-devs/s -g

yarn global add @serverless-devs/s

安装成功后运行 s config 配置 Account ID、Access Key ID、Secret Access Key、Default Region Name。

克隆(或下载)本仓库:

git clone [email protected]:justjavac/deno_serverless_aliyun.git

部署

cd deno_serverless_aliyun
s deploy

自定义部署:

  1. 使用 Deno 打包 TypeScript 文件。这一步是可选的,提前打包文件而不是在运行时再编译可以提升 Deno Serverless 的冷启动性能。

    deno task build
  2. 构建 Deno Serverless 运行环境:

    s build
  3. 部署

    s deploy

测试

部署完成后我们可以测试刚才的函数。

s invoke --event "Hello World"

控制台输出:

...
FC Invoke Result:
Hello World

第一次运行时函数需要冷启,会稍微有点慢。

Duration: 9.27 ms, Billed Duration: 12 ms, Memory Size: 512 MB, Max Memory Used: 41.50 MB
Duration: 1.66 ms, Billed Duration: 2 ms, Memory Size: 512 MB, Max Memory Used: 41.62 MB
Duration: 1.41 ms, Billed Duration: 2 ms, Memory Size: 512 MB, Max Memory Used: 41.87 MB
Duration: 1.50 ms, Billed Duration: 2 ms, Memory Size: 512 MB, Max Memory Used: 42.25 MB
Duration: 1.41 ms, Billed Duration: 2 ms, Memory Size: 512 MB, Max Memory Used: 42.50 MB

许可协议

deno_serverless_aliyun 基于 MIT 许可协议发布。详细信息可以查看 LICENSE 文件。

deno_serverless_aliyun's People

Contributors

justjavac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

yugasun

deno_serverless_aliyun's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.