feat: 添加路由前缀
This commit is contained in:
parent
dca8afc9cd
commit
abd6bd83a0
8
index.ts
8
index.ts
@ -10,12 +10,14 @@ const server = Bun.serve({
|
|||||||
async fetch(req) {
|
async fetch(req) {
|
||||||
try {
|
try {
|
||||||
const url = new URL(req.url)
|
const url = new URL(req.url)
|
||||||
|
const prefix = "/gitlab"
|
||||||
// 根路由
|
// 根路由
|
||||||
if (url.pathname === "/") return netTool.ok("hello, glade to see you!")
|
if (url.pathname === `${prefix}/`)
|
||||||
|
return netTool.ok("hello, glade to see you!")
|
||||||
// CI 监控
|
// CI 监控
|
||||||
if (url.pathname === "/ci") return manageCIMonitorReq(req)
|
if (url.pathname === `${prefix}/ci`) return manageCIMonitorReq(req)
|
||||||
// Gitlab 事件
|
// Gitlab 事件
|
||||||
if (url.pathname === "/event") return manageGitlabEventReq(req)
|
if (url.pathname === `${prefix}/event`) return manageGitlabEventReq(req)
|
||||||
// 其他
|
// 其他
|
||||||
return netTool.ok("hello, glade to see you!")
|
return netTool.ok("hello, glade to see you!")
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user