Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ArbYusuf authored Dec 25, 2023
1 parent 27246b0 commit 7fbe573
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import express from "express";
import http from "node:http";
import http from "http";
import createBareServer from "@tomphttp/bare-server-node";
import path from "node:path";
import path from "path";
import * as dotenv from "dotenv";
dotenv.config();

const __dirname = process.cwd();
const server = http.createServer();
const app = express(server);
const app = express();
const server = http.createServer(app);
const bareServer = createBareServer("/bare/");

app.use(express.json());
Expand All @@ -34,7 +34,6 @@ app.get("/settings", (req, res) => {
res.sendFile(path.join(__dirname, "static", "settings.html"));
});


server.on("request", (req, res) => {
if (bareServer.shouldRoute(req)) {
bareServer.routeRequest(req, res);
Expand All @@ -52,9 +51,9 @@ server.on("upgrade", (req, socket, head) => {
});

server.on("listening", () => {
console.log(`Snorlax's Cave listening on port 8080 ${process.env.PORT}`);
console.log(`Snorlax's Cave listening on port ${process.env.PORT}`);
});

server.listen({
port: process.env.PORT,
});
});

0 comments on commit 7fbe573

Please sign in to comment.