Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

是否可以整个放到pages? #8

Open
qingyuan0o0 opened this issue Jan 11, 2024 · 1 comment
Open

是否可以整个放到pages? #8

qingyuan0o0 opened this issue Jan 11, 2024 · 1 comment

Comments

@qingyuan0o0
Copy link

如题,目前是放在worker,然后加载github.io,如果提交到pages,是一样可以调用worker的边缘计算,写一个教程?

@crazypeace
Copy link
Owner

想法不错, 你可以试试.

目前项目的结构是这样:
入口是 worker.js
根据 path 来判断返回一个怎样的页面.

  • 是合法的 password , 返回一个可操作的界面
  • 能查询到 value 的值, 302 跳转这个value (长网址)
    查询的方法是向 worker.js 发 API
  • 非法 path, 返回 404 或 302 跳转

简化的理解, 如果去掉password部分的逻辑.
你可以理解为 worker.js + KV数据库 是后端.
index.html + main.js 是前端.

前端与后端之间是用 API 调用.
其实如果你自己调试, 可以在本地浏览器打开 index.html 文件 (当然, 需要手动修改一下 password, api网址参数)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants