add router

This commit is contained in:
2024-10-15 18:53:09 +08:00
parent 6b5eec89ed
commit 175e685480
6 changed files with 67 additions and 113 deletions

View File

@@ -8,7 +8,6 @@ import { useConfig } from '@abearxiong/use-config';
import { redis } from './redis/redis.ts';
import { getContentType } from './get-content-type.ts';
import { sleep } from '@/utils/sleep.ts';
import { handleProxyRequest } from './proxy.ts';
const { api, domain, allowedOrigins } = useConfig<{
api: {
host: string;
@@ -71,10 +70,7 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR
res.end('not catch api');
return;
}
if (req.url.startsWith('/test')) {
handleProxyRequest(req, res);
return;
}
const dns = getDNS(req);
// 配置可以跨域
// 配置可以访问的域名 localhost, xiongxiao.me