Add features: custom server and websocket. Minor refactoring

This commit is contained in:
2026-03-21 07:42:38 +01:00
parent 1611c845b9
commit 98d3cf7da7
29 changed files with 321 additions and 286 deletions
+9 -6
View File
@@ -1,17 +1,20 @@
import grabAppPort from "../../utils/grab-app-port";
import isDevelopment from "../../utils/is-development";
import bunextRequestHandler from "./bunext-req-handler";
export default async function (params) {
import grabConfig from "../grab-config";
import _ from "lodash";
export default async function () {
const port = grabAppPort();
const is_dev = isDevelopment();
const development = isDevelopment();
const config = await grabConfig();
return {
async fetch(req, server) {
return await bunextRequestHandler({ req });
},
port,
// idleTimeout: 0,
development: {
hmr: true,
},
idleTimeout: development ? 0 : undefined,
development,
websocket: config?.websocket,
..._.omit(config?.serverOptions || {}, ["fetch"]),
};
}