Remove index.js.bak.
This commit is contained in:
parent
e9bc8b6de3
commit
0fbe2e8f8e
2 changed files with 1 additions and 59 deletions
58
index.js.bak
58
index.js.bak
|
|
@ -1,58 +0,0 @@
|
|||
import { createBareServer } from "@tomphttp/bare-server-node";
|
||||
import { uvPath } from "@nebula-services/ultraviolet";
|
||||
import http from "node:http";
|
||||
import path from "node:path";
|
||||
import express from "express";
|
||||
import { handler as ssrHandler } from "./dist/server/entry.mjs";
|
||||
import dotenv from "dotenv";
|
||||
import compression from "compression";
|
||||
import createRammerhead from "rammerhead/src/server/index.js";
|
||||
import chalk from "chalk";
|
||||
dotenv.config();
|
||||
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
const server = http.createServer();
|
||||
const app = express(server);
|
||||
const bareServer = createBareServer("/bare/");
|
||||
app.use(compression());
|
||||
app.use(express.static(path.join(process.cwd(), "static")));
|
||||
app.use(express.static(path.join(process.cwd(), "build")));
|
||||
app.use("/uv/", express.static(uvPath));
|
||||
app.use(express.json());
|
||||
app.use(
|
||||
express.urlencoded({
|
||||
extended: true,
|
||||
})
|
||||
);
|
||||
app.use("/", express.static("dist/client/"));
|
||||
app.use(ssrHandler);
|
||||
|
||||
app.get("*", function (req, res) {
|
||||
res.status(200).sendFile("404.html", { root: path.resolve("dist/client") });
|
||||
});
|
||||
|
||||
server.on('request', (req, res) => {
|
||||
if (bareServer.shouldRoute(req)) {
|
||||
bareServer.routeRequest(req, res);
|
||||
} else {
|
||||
app(req, res);
|
||||
}
|
||||
});
|
||||
|
||||
server.on('upgrade', (req, socket, head) => {
|
||||
if (bareServer.shouldRoute(req)) {
|
||||
bareServer.routeUpgrade(req, socket, head);
|
||||
} else {
|
||||
socket.end();
|
||||
}
|
||||
});
|
||||
|
||||
console.log(chalk.gray("Starting Alu..."));
|
||||
server.on("listening", () => {
|
||||
console.log(chalk.green(`Server running at http://localhost:${PORT}/.`));
|
||||
});
|
||||
|
||||
server.listen({
|
||||
port: PORT,
|
||||
});
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit e844ef805e9be581ac8cec496008b1652b79071e
|
||||
Subproject commit 14900d4bdbc942cabb30e053c6d958ab37fb0493
|
||||
Loading…
Add table
Reference in a new issue