mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-17 13:30:00 -04:00
move wisp to plugin, remove build rq for running api
This commit is contained in:
parent
77dbccfc7e
commit
d70ff2f4cf
5 changed files with 101 additions and 77 deletions
15
server/vite-plugin-wisp.ts
Normal file
15
server/vite-plugin-wisp.ts
Normal 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
|
||||
);
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue