UEA-Prodem
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
import { __toESM, require_objectSpread2 } from "../getErrorShape-BPSzUA7W.mjs";
|
||||
import { run } from "../codes-DagpWZLc.mjs";
|
||||
import "../tracked-DWInO6EQ.mjs";
|
||||
import "../parseTRPCMessage-CTow-umk.mjs";
|
||||
import "../resolveResponse-CdASWfAV.mjs";
|
||||
import "../contentTypeParsers-SN4WL9ze.mjs";
|
||||
import "../unstable-core-do-not-import-9NNw8uQM.mjs";
|
||||
import "../observable-UMO3vUa_.mjs";
|
||||
import "../initTRPC-BRf4imah.mjs";
|
||||
import { createURL, internal_exceptionHandler, nodeHTTPRequestHandler } from "../node-http-gyWQuCv2.mjs";
|
||||
import http from "http";
|
||||
|
||||
//#region src/adapters/standalone.ts
|
||||
var import_objectSpread2 = __toESM(require_objectSpread2(), 1);
|
||||
function createHandler(opts) {
|
||||
var _opts$basePath;
|
||||
const basePath = (_opts$basePath = opts.basePath) !== null && _opts$basePath !== void 0 ? _opts$basePath : "/";
|
||||
const sliceLength = basePath.length;
|
||||
return (req, res) => {
|
||||
let path = "";
|
||||
run(async () => {
|
||||
const url = createURL(req);
|
||||
path = url.pathname.slice(sliceLength);
|
||||
await nodeHTTPRequestHandler((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, {
|
||||
req,
|
||||
res,
|
||||
path
|
||||
}));
|
||||
}).catch(internal_exceptionHandler((0, import_objectSpread2.default)({
|
||||
req,
|
||||
res,
|
||||
path
|
||||
}, opts)));
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function createHTTPHandler(opts) {
|
||||
return createHandler(opts);
|
||||
}
|
||||
function createHTTPServer(opts) {
|
||||
return http.createServer(createHTTPHandler(opts));
|
||||
}
|
||||
function createHTTP2Handler(opts) {
|
||||
return createHandler(opts);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
export { createHTTP2Handler, createHTTPHandler, createHTTPServer };
|
||||
//# sourceMappingURL=standalone.mjs.map
|
||||
Reference in New Issue
Block a user