Skip to content

Commit 7778e95

Browse files
切换为 goja
1 parent b20207d commit 7778e95

29 files changed

+634
-575
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
55
**This project is part of Dragon's Zone HomeLab**
66

7-
This project focuses on functional implementation and does not consider any performance optimizations or large-scale deployment scenarios. Any issues arising from this are not related to the project.
7+
This project focuses on functional implementation and does not consider any performance optimizations or large-scale
8+
deployment scenarios. Any issues arising from this are not related to the project.
89

9-
**Note**: The project recently added custom renderers and reverse proxy functionality, which may lead to serious security and performance issues. If not needed, it can be turned off in the settings.
10+
**Note**: The project recently added custom renderers and reverse proxy functionality, which may lead to serious
11+
security and performance issues. If not needed, it can be turned off in the settings.
1012

1113
## Get Started
1214

@@ -29,15 +31,13 @@ For specific configurations, check [`config.yaml`](./config.yaml).
2931
Create `.pages.yaml` in the project's `gh-pages` branch and fill in the following content:
3032

3133
```yaml
32-
v-route: true # Virtual routing
3334
alias: # CNAME
3435
- "example.com"
3536
- "example2.com"
36-
templates: # Renderer
37-
gotemplate: '**/*.tmpl,**/index.html'
38-
proxy:
39-
/api: https://github.com/api
40-
ignore: .git/**,.pages.yaml
37+
routes:
38+
- path: "**"
39+
js:
40+
exec: index.js
4141
```
4242
4343
## TODO

README_zh.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@ make gitea-pages
2929
在项目的 `gh-pages` 分支创建 `.pages.yaml`,填入如下内容
3030

3131
```yaml
32-
v-route: true # 虚拟路由
3332
alias: # CNAME
3433
- "example.com"
3534
- "example2.com"
36-
templates: # 渲染器
37-
gotemplate: '**/*.tmpl,**/index.html'
38-
proxy:
39-
/api: https://github.com/api
40-
ignore: .git/**,.pages.yaml
35+
routes:
36+
- path: "**"
37+
js:
38+
exec: index.js
4139
```
4240
4341
## TODO

examples/HelloWorld/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport"
66
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
77
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8-
<title>qjs 验证</title>
8+
<title>js 验证</title>
99
</head>
1010
<body>
1111
<p>Hello World</p>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
routes:
22
- path: "api/dev/**"
3-
qjs:
3+
js:
44
exec: "index.js"
55
debug: true
66
- path: "api/prod/**"
7-
qjs:
7+
js:
88
exec: "json.js"

examples/QuickJS/index.html renamed to examples/JS/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport"
66
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
77
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8-
<title>Quickjs 概念验证</title>
8+
<title>JS 概念验证</title>
99
</head>
1010
<body>
1111

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
response.write("hello world")
22
console.log("hello world")
3-
console.log(req.methaaod)
43
function testError(){
54
throw Error("Method not implemented")
65
}
6+
response.setHeader("content-type", "application/json")
77
testError()
File renamed without changes.

examples/kv/.pages.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
routes:
2+
- path: "get"
3+
js:
4+
exec: "index.js"
5+
debug: true
6+
7+
- path: "put"
8+
js:
9+
exec: "index.js"
10+
debug: true

examples/kv/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport"
6+
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<title>JS 概念验证</title>
9+
</head>
10+
<body>
11+
<a href="/get">查询数据</a>
12+
<a href="/put">更新数据</a>
13+
</body>
14+
</html>

examples/kv/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var db = kv.repo("self");
2+
if(request.path == "put"){
3+
data = db.get('key')
4+
if(data == undefined){
5+
db.set('key','0')
6+
}else {
7+
db.set('key',(parseInt(data)+1).toString())
8+
}
9+
}
10+
response.write("当前存储的数值为 " + db.get('key'))

0 commit comments

Comments
 (0)