Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Notplayingallday383 committed Dec 31, 2024
1 parent 76a0b34 commit 4852a5d
Show file tree
Hide file tree
Showing 35 changed files with 3,167 additions and 5,379 deletions.
12 changes: 2 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
import { createBareServer } from "@nebula-services/bare-server-node";
import express from "express";
import { createServer } from "node:http";
import path from "path";
import fs from "fs";
import { fileURLToPath } from "url";
import wisp from "wisp-server-node";
import { server as wisp } from "@mercuryworkshop/wisp-js";
import "ws";

console.log("Starting Terbium...");
const app = express();
const bare = createBareServer('/bare/')
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

app.use(express.static("static"));
const server = createServer();

server.on("request", (req, res) => {
if (bare.shouldRoute(req)) {
bare.routeRequest(req, res);
} else {
app(req, res);
}
app(req, res);
});

server.on("upgrade", (req, socket, head) => {
if (req.url.endsWith("/wisp/")) {
wisp.routeRequest(req, socket, head);
} else if (req.url.endsWith("/bare")) {
bare.routeUpgrade(req, socket, head);
}
});

Expand Down
Loading

0 comments on commit 4852a5d

Please sign in to comment.