This commit is contained in:
MotorTruck1221 2025-05-05 00:16:07 -06:00
parent 44a42117f3
commit e53b28f777
No known key found for this signature in database
GPG key ID: 08F417E2B8B61EA4
3 changed files with 26 additions and 21 deletions

View file

@ -11,7 +11,8 @@
"build": "npm run build:server & npm run build:client",
"start": "node server/index.js",
"bstart": "npm run build && npm run start",
"astro": "astro"
"astro": "astro",
"format": "biome format --write ."
},
"dependencies": {
"@astrojs/check": "^0.9.4",

View file

@ -1,4 +1,10 @@
import Fastify, { FastifyReply, FastifyRequest, FastifyServerFactory, FastifyServerFactoryHandler, RawServerDefault } from "fastify";
import Fastify, {
FastifyReply,
FastifyRequest,
FastifyServerFactory,
FastifyServerFactoryHandler,
RawServerDefault
} from "fastify";
import fastifyMiddie from "@fastify/middie";
import fastifyStatic from "@fastify/static";
import { fileURLToPath } from "node:url";
@ -9,17 +15,19 @@ import { handler as astroHandler } from "../dist/server/entry.mjs";
import { createServer } from "node:http";
import { Socket } from "node:net";
const serverFactory: FastifyServerFactory = ( handler: FastifyServerFactoryHandler): RawServerDefault => {
const serverFactory: FastifyServerFactory = (
handler: FastifyServerFactoryHandler
): RawServerDefault => {
return createServer()
.on('request', (req, res) => {
.on("request", (req, res) => {
handler(req, res);
})
.on('upgrade', (req, socket, head) => {
if (req.url?.endsWith('/wisp/')) {
.on("upgrade", (req, socket, head) => {
if (req.url?.endsWith("/wisp/")) {
wisp.routeRequest(req, socket as Socket, head);
}
})
}
});
};
const app = Fastify({
logger: false,

View file

@ -8,15 +8,11 @@ import Header from "@components/Header.astro";
import "@styles/global.css";
import "@styles/default.css";
readdir(
pathJoin("src", "styles", "themes"),
{ encoding: "utf-8" },
(err, files) => {
readdir(pathJoin("src", "styles", "themes"), { encoding: "utf-8" }, (err, files) => {
files.forEach(async (name) => {
await import(`../styles/themes/${name.replace(".css", "")}.css`);
});
}
);
});
---
<!doctype html>
<html lang="en">