Giter Site home page Giter Site logo

deno_deploy_examples's Introduction

deno_deploy_examples

Build Status license

Deno 官方提供了一个类似 Cloudflare Workers 的 Serverless 平台,让开发者可以轻松的部署 Deno 代码。

:去年我注册了 deno.dev 域名,随后将其送给了 ry。目前此域名用于代码部署服务,代码的默认部署域名为 {project_name}-{deployment_id}.deno.dev

步骤

  1. 进入 https://deno.com/deploy 网站,点击右上角 Sign in
  2. 默认可以使用 github 直接登录。
  3. 点击 New Project 创建一个新项目。
  4. 可以直接通过 url 部署,或者在设置(Setting)里面关联 GitHub 后在每次 push 的时候自动部署。

本地开发

  1. 安装命令行工具
deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -r -f https://deno.land/x/deploy/deployctl.ts
  1. 生成类型定义文件
deployctl types > deployctl.d.ts
  1. 新建 mod.ts 文件开始编写代码
/// <reference path="./deployctl.d.ts" />

addEventListener("fetch", (event: FetchEvent) => {
  const response = new Response("Hello World!", {
    headers: { "content-type": "text/plain" },
  });
  event.respondWith(response);
});
  1. 本地启动服务
deployctl run --no-check --watch ./mod.ts

⚠️ 目前需要添加 --no-check 参数。

deno_deploy_examples's People

Contributors

justjavac avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

Forkers

7777sea getpro

deno_deploy_examples'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.