mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-15 12:40:00 -04:00
Add wisp server node
This commit is contained in:
parent
d213843bbf
commit
521c2b8cdf
3 changed files with 17 additions and 6 deletions
|
@ -34,7 +34,8 @@
|
|||
"react-i18next": "^13.5.0",
|
||||
"react-icons": "^4.12.0",
|
||||
"react-toastify": "^9.1.3",
|
||||
"tsx": "^4.7.0"
|
||||
"tsx": "^4.7.0",
|
||||
"wisp-server-node": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@preact/preset-vite": "^2.5.0",
|
||||
|
|
7
pnpm-lock.yaml
generated
7
pnpm-lock.yaml
generated
|
@ -77,6 +77,9 @@ dependencies:
|
|||
tsx:
|
||||
specifier: ^4.7.0
|
||||
version: 4.7.0
|
||||
wisp-server-node:
|
||||
specifier: ^1.0.1
|
||||
version: 1.0.1
|
||||
|
||||
devDependencies:
|
||||
'@preact/preset-vite':
|
||||
|
@ -6033,6 +6036,10 @@ packages:
|
|||
string-width: 4.2.3
|
||||
dev: false
|
||||
|
||||
/wisp-server-node@1.0.1:
|
||||
resolution: {integrity: sha512-RPid1o/q8NWE0zVFmMIUBIWS7WnUeHmfzrxaNeFsWKXYKD5RO74qYnDLbXSKFDCTSrPQ+uXtRI2I/EpunXfAvw==}
|
||||
dev: false
|
||||
|
||||
/wrap-ansi@7.0.0:
|
||||
resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
|
||||
engines: {node: '>=10'}
|
||||
|
|
13
server.ts
13
server.ts
|
@ -3,11 +3,14 @@ import fastifyStatic from "@fastify/static";
|
|||
import { fileURLToPath } from "url";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
import createRammerhead from "rammerhead/src/server/index.js";
|
||||
import cookieParser from "@fastify/cookie";
|
||||
import { createBareServer } from "@nebula-services/bare-server-node";
|
||||
import { createServer } from "http";
|
||||
|
||||
import { createBareServer } from "@nebula-services/bare-server-node";
|
||||
import createRammerhead from "rammerhead/src/server/index.js";
|
||||
import wisp from "wisp-server-node";
|
||||
import { Socket } from "net";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
|
@ -70,6 +73,8 @@ const serverFactory = (handler, opts) => {
|
|||
bare.routeUpgrade(req, socket, head);
|
||||
} else if (shouldRouteRh(req)) {
|
||||
routeRhUpgrade(req, socket, head);
|
||||
} else {
|
||||
wisp.routeRequest(req, socket as Socket, head);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -77,9 +82,7 @@ const serverFactory = (handler, opts) => {
|
|||
const app = fastify({ logger: true, serverFactory });
|
||||
|
||||
app.register(cookieParser);
|
||||
await app.register(
|
||||
import("@fastify/compress")
|
||||
);
|
||||
await app.register(import("@fastify/compress"));
|
||||
|
||||
// Uncomment if you wish to add masqr.
|
||||
/* app.addHook("preHandler", async (req, reply) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue