move wisp to plugin, remove build rq for running api

This commit is contained in:
tgt 2025-02-18 10:46:01 -05:00
parent 77dbccfc7e
commit d70ff2f4cf
5 changed files with 101 additions and 77 deletions

View file

@ -0,0 +1,15 @@
import { Socket } from "node:net";
import wisp from "wisp-server-node";
import { wispOptions } from "./serverFactory";
export const wispPlugin = {
name: "vite-plugin-wisp",
configureServer(server) {
server.wisp = wisp;
server.httpServer?.on("upgrade", (req, socket: Socket, head) =>
req.url?.endsWith("/wisp/")
? wisp.routeRequest(req, socket, head, wispOptions)
: undefined
);
}
};