feat: 更新 HTTP 路由处理,移除旧的自定义端点并添加新的 API 路由;更新依赖版本
This commit is contained in:
@@ -2,38 +2,17 @@ import { httpRouter } from "convex/server";
|
||||
import { httpAction } from "./_generated/server.js";
|
||||
const http = httpRouter();
|
||||
|
||||
http.route({
|
||||
path: "/auth",
|
||||
method: "POST",
|
||||
handler: httpAction(async (ctx, request) => {
|
||||
// 处理请求并返回响应
|
||||
return new Response(JSON.stringify({ message: "Hello from custom endpoint!" }), {
|
||||
const handler = httpAction(async (ctx, request) => {
|
||||
return new Response(JSON.stringify({ message: "Hello!" }), {
|
||||
status: 200,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
}),
|
||||
})
|
||||
});
|
||||
|
||||
// 分开注册
|
||||
http.route({ path: "/api/router", method: "GET", handler });
|
||||
http.route({ path: "/api/router", method: "POST", handler });
|
||||
http.route({ path: "/api/router", method: "OPTIONS", handler });
|
||||
|
||||
|
||||
// https://api-convex.kevisual.cn/root/convex/jwks.json
|
||||
http.route({
|
||||
path: '/root/convex/jwks.json',
|
||||
method: 'GET',
|
||||
handler: httpAction(async (ctx, request) => {
|
||||
// 返回 JWKS 数据
|
||||
const jwks = {
|
||||
"keys": [
|
||||
{
|
||||
"kty": "RSA",
|
||||
"n": "km4cjJJOMFkl2G5qWMuFmWwF7rmeqRYzYdR8SddKeeMW0e9yIf5pv2Mfwv0aMJUpb-_j3j9M7whx_SEGc_2jx1vxCu1AlYURhnnLTWdsR-ZRPr2LK9UstMrgpWV425R2RliqXTDTYlSxUUlD9nPue_tqbfwN2aM9MCarm67xK_ZCcKRlW9o9L2-9UMfzRA7uiy4VQtOemP0PTXp-E9RxNiMPOQXIRls9wTW_EkDT3dGy7JCZhj7_qib3T8k9m84SwU7wI2R_3IH4DcHSMAn1BRRMXZ1_wPhbP39laNtdJgbDjGCqUccGhLUaoo2WGkZ52eb7NPqamp0K1Dh2jwTIJQ",
|
||||
"e": "AQAB",
|
||||
"kid": "kid-key-1"
|
||||
}
|
||||
]
|
||||
};
|
||||
return new Response(JSON.stringify(jwks), {
|
||||
status: 200,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
}),
|
||||
})
|
||||
export default http;
|
||||
@@ -13,16 +13,16 @@
|
||||
"keywords": [],
|
||||
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
|
||||
"license": "MIT",
|
||||
"packageManager": "pnpm@10.28.2",
|
||||
"packageManager": "pnpm@10.30.3",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@kevisual/types": "^0.0.12",
|
||||
"@types/bun": "^1.3.8",
|
||||
"@types/node": "^25.2.0"
|
||||
"@types/bun": "^1.3.9",
|
||||
"@types/node": "^25.3.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kevisual/auth": "^2.0.3",
|
||||
"convex": "1.31.7",
|
||||
"convex": "1.32.0",
|
||||
"jose": "^6.1.3"
|
||||
},
|
||||
"exports": {
|
||||
|
||||
66
pnpm-lock.yaml
generated
66
pnpm-lock.yaml
generated
@@ -12,8 +12,8 @@ importers:
|
||||
specifier: ^2.0.3
|
||||
version: 2.0.3
|
||||
convex:
|
||||
specifier: 1.31.7
|
||||
version: 1.31.7
|
||||
specifier: 1.32.0
|
||||
version: 1.32.0
|
||||
jose:
|
||||
specifier: ^6.1.3
|
||||
version: 6.1.3
|
||||
@@ -22,11 +22,11 @@ importers:
|
||||
specifier: ^0.0.12
|
||||
version: 0.0.12
|
||||
'@types/bun':
|
||||
specifier: ^1.3.8
|
||||
version: 1.3.8
|
||||
specifier: ^1.3.9
|
||||
version: 1.3.9
|
||||
'@types/node':
|
||||
specifier: ^25.2.0
|
||||
version: 25.2.0
|
||||
specifier: ^25.3.3
|
||||
version: 25.3.3
|
||||
|
||||
packages:
|
||||
|
||||
@@ -192,17 +192,17 @@ packages:
|
||||
'@kevisual/types@0.0.12':
|
||||
resolution: {integrity: sha512-zJXH2dosir3jVrQ6QG4i0+iLQeT9gJ3H+cKXs8ReWboxBSYzUZO78XssVeVrFPsJ33iaAqo4q3DWbSS1dWGn7Q==}
|
||||
|
||||
'@types/bun@1.3.8':
|
||||
resolution: {integrity: sha512-3LvWJ2q5GerAXYxO2mffLTqOzEu5qnhEAlh48Vnu8WQfnmSwbgagjGZV6BoHKJztENYEDn6QmVd949W4uESRJA==}
|
||||
'@types/bun@1.3.9':
|
||||
resolution: {integrity: sha512-KQ571yULOdWJiMH+RIWIOZ7B2RXQGpL1YQrBtLIV3FqDcCu6FsbFUBwhdKUlCKUpS3PJDsHlJ1QKlpxoVR+xtw==}
|
||||
|
||||
'@types/node@25.2.0':
|
||||
resolution: {integrity: sha512-DZ8VwRFUNzuqJ5khrvwMXHmvPe+zGayJhr2CDNiKB1WBE1ST8Djl00D0IC4vvNmHMdj6DlbYRIaFE7WHjlDl5w==}
|
||||
'@types/node@25.3.3':
|
||||
resolution: {integrity: sha512-DpzbrH7wIcBaJibpKo9nnSQL0MTRdnWttGyE5haGwK86xgMOkFLp7vEyfQPGLOJh5wNYiJ3V9PmUMDhV9u8kkQ==}
|
||||
|
||||
bun-types@1.3.8:
|
||||
resolution: {integrity: sha512-fL99nxdOWvV4LqjmC+8Q9kW3M4QTtTR1eePs94v5ctGqU8OeceWrSUaRw3JYb7tU3FkMIAjkueehrHPPPGKi5Q==}
|
||||
bun-types@1.3.9:
|
||||
resolution: {integrity: sha512-+UBWWOakIP4Tswh0Bt0QD0alpTY8cb5hvgiYeWCMet9YukHbzuruIEeXC2D7nMJPB12kbh8C7XJykSexEqGKJg==}
|
||||
|
||||
convex@1.31.7:
|
||||
resolution: {integrity: sha512-PtNMe1mAIOvA8Yz100QTOaIdgt2rIuWqencVXrb4McdhxBHZ8IJ1eXTnrgCC9HydyilGT1pOn+KNqT14mqn9fQ==}
|
||||
convex@1.32.0:
|
||||
resolution: {integrity: sha512-5FlajdLpW75pdLS+/CgGH5H6yeRuA+ru50AKJEYbJpmyILUS+7fdTvsdTaQ7ZFXMv0gE8mX4S+S3AtJ94k0mfw==}
|
||||
engines: {node: '>=18.0.0', npm: '>=7.0.0'}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
@@ -230,8 +230,20 @@ packages:
|
||||
engines: {node: '>=14'}
|
||||
hasBin: true
|
||||
|
||||
undici-types@7.16.0:
|
||||
resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==}
|
||||
undici-types@7.18.2:
|
||||
resolution: {integrity: sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==}
|
||||
|
||||
ws@8.18.0:
|
||||
resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
peerDependencies:
|
||||
bufferutil: ^4.0.1
|
||||
utf-8-validate: '>=5.0.2'
|
||||
peerDependenciesMeta:
|
||||
bufferutil:
|
||||
optional: true
|
||||
utf-8-validate:
|
||||
optional: true
|
||||
|
||||
snapshots:
|
||||
|
||||
@@ -317,22 +329,26 @@ snapshots:
|
||||
|
||||
'@kevisual/types@0.0.12': {}
|
||||
|
||||
'@types/bun@1.3.8':
|
||||
'@types/bun@1.3.9':
|
||||
dependencies:
|
||||
bun-types: 1.3.8
|
||||
bun-types: 1.3.9
|
||||
|
||||
'@types/node@25.2.0':
|
||||
'@types/node@25.3.3':
|
||||
dependencies:
|
||||
undici-types: 7.16.0
|
||||
undici-types: 7.18.2
|
||||
|
||||
bun-types@1.3.8:
|
||||
bun-types@1.3.9:
|
||||
dependencies:
|
||||
'@types/node': 25.2.0
|
||||
'@types/node': 25.3.3
|
||||
|
||||
convex@1.31.7:
|
||||
convex@1.32.0:
|
||||
dependencies:
|
||||
esbuild: 0.27.0
|
||||
prettier: 3.8.1
|
||||
ws: 8.18.0
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
|
||||
esbuild@0.27.0:
|
||||
optionalDependencies:
|
||||
@@ -367,4 +383,6 @@ snapshots:
|
||||
|
||||
prettier@3.8.1: {}
|
||||
|
||||
undici-types@7.16.0: {}
|
||||
undici-types@7.18.2: {}
|
||||
|
||||
ws@8.18.0: {}
|
||||
|
||||
Reference in New Issue
Block a user