feat: 后端初始化

This commit is contained in:
2026-07-28 10:54:47 +08:00
parent 88f5371ed8
commit dfe0d6bd95
24 changed files with 22326 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
export const readJson = async <T = unknown>(request: Request): Promise<T> => {
const contentType = request.headers.get('content-type') || ''
if (!contentType.includes('application/json')) {
return {} as T
}
return request.json() as Promise<T>
}
export const getBearerToken = (request: Request) => {
const authorization = request.headers.get('authorization') || ''
const match = authorization.match(/^Bearer\s+(.+)$/i)
return match?.[1] || ''
}