切换为 goja

This commit is contained in:
dragon
2025-11-17 17:33:40 +08:00
parent b20207de4c
commit 7778e95194
29 changed files with 634 additions and 575 deletions

8
examples/JS/.pages.yaml Normal file
View File

@@ -0,0 +1,8 @@
routes:
- path: "api/dev/**"
js:
exec: "index.js"
debug: true
- path: "api/prod/**"
js:
exec: "json.js"

13
examples/JS/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>JS 概念验证</title>
</head>
<body>
</body>
</html>

7
examples/JS/index.js Normal file
View File

@@ -0,0 +1,7 @@
response.write("hello world")
console.log("hello world")
function testError(){
throw Error("Method not implemented")
}
response.setHeader("content-type", "application/json")
testError()

4
examples/JS/json.js Normal file
View File

@@ -0,0 +1,4 @@
resp.setHeader("content-type", "application/json");
resp.write(JSON.stringify({
'method': req.method,
}))