Git Product home page Git Product logo

pastebin-worker's Introduction

开始开发

  1. 安装 wrangler-cli
npm i @cloudflare/wrangler -g

根据文档登录 cloudflare 账号

  1. 安装依赖
# 安装后端依赖
yarn install

# 安装前端依赖
cd static
yarn install
  1. 修改 wrangler.toml

其中 account_idroute, kv_namespaces 需要根据自己的情况修改

account_id 可以在 cloudflare 的 dashboard 中找到, route 是你的 worker 的路由(也就是自定义域名),kv_namespaces 是你创建的 kv 的 id

  1. 开发
# 启动后端
wrangler dev

# 启动前端
cd static
yarn dev

服务器启动后,后端的地址是 http://localhost:8787,前端的地址是 http://localhost:5173,如果想测试前端打包后的情况,直接在 static 目录执行 yarn build,然后访问 http://localhost:8787 就可以了

部署

获取你的 cloudflare 账号的 api key,然后设置为 github aciton 的 secret,名字为CF_API_KEY,这样每次 push 代码到 main 分支,就会自动部署到 cloudflare

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.