mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-27 04:16:37 +08:00
Merge 3dc5bb8232
into 5f1c5945f8
This commit is contained in:
commit
cd8fe2408a
23
_worker.js
Normal file
23
_worker.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// /_worker.js
|
||||||
|
|
||||||
|
// --- 适配器部分 ---
|
||||||
|
import { Buffer } from 'node:buffer';
|
||||||
|
import { connect } from 'node:net';
|
||||||
|
import { ReadableStream, TransformStream } from 'node:stream/web';
|
||||||
|
import { fetch } from 'undici';
|
||||||
|
|
||||||
|
globalThis.Buffer = Buffer;
|
||||||
|
globalThis.fetch = fetch;
|
||||||
|
globalThis.connect = connect;
|
||||||
|
globalThis.ReadableStream = ReadableStream;
|
||||||
|
globalThis.TransformStream = TransformStream;
|
||||||
|
// --- 适配器部分结束 ---
|
||||||
|
|
||||||
|
// --- 启动 new-api 应用 ---
|
||||||
|
import app from './build/app.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
async fetch(request, env, ctx) {
|
||||||
|
return app.fetch(request, env, ctx);
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user