From ffd28572f0e1458b03da06341bb115fdcf24c987 Mon Sep 17 00:00:00 2001 From: 9pfs <9pfs@amcforum.wiki> Date: Sat, 6 Jul 2024 01:08:38 +0000 Subject: [PATCH] Start adding content --- helpers/database.js | 3 +++ public/primary.css | 3 +++ routes/index.js | 6 ++++++ routes/static.js | 4 ++++ server.js | 16 ++++++++++++++++ views/homepage.ejs | 9 +++++++++ 6 files changed, 41 insertions(+) create mode 100644 helpers/database.js create mode 100644 public/primary.css create mode 100644 routes/index.js create mode 100644 routes/static.js create mode 100644 server.js create mode 100644 views/homepage.ejs diff --git a/helpers/database.js b/helpers/database.js new file mode 100644 index 0000000..6ca4370 --- /dev/null +++ b/helpers/database.js @@ -0,0 +1,3 @@ +import { PrismaClient } from "@prisma/client"; +const prisma = new PrismaClient(); +export default prisma; \ No newline at end of file diff --git a/public/primary.css b/public/primary.css new file mode 100644 index 0000000..ec2f93f --- /dev/null +++ b/public/primary.css @@ -0,0 +1,3 @@ +:root { + color-scheme: light dark; +} \ No newline at end of file diff --git a/routes/index.js b/routes/index.js new file mode 100644 index 0000000..09a4ad1 --- /dev/null +++ b/routes/index.js @@ -0,0 +1,6 @@ +import { Router } from "express"; +import prisma from "../helpers/database.js"; +import staticRouter from "./static.js"; +const faqRouter = new Router(); +faqRouter.use(staticRouter); +export default faqRouter; \ No newline at end of file diff --git a/routes/static.js b/routes/static.js new file mode 100644 index 0000000..d1b94a5 --- /dev/null +++ b/routes/static.js @@ -0,0 +1,4 @@ +import { Router, static as static_ } from "express"; +const staticRouter = Router(); +staticRouter.use("/", static_("public")); +export default staticRouter; \ No newline at end of file diff --git a/server.js b/server.js new file mode 100644 index 0000000..8d0189c --- /dev/null +++ b/server.js @@ -0,0 +1,16 @@ +import express from "express"; +import faqRouter from "./routes/index.js"; +const app = express(); +app.use(faqRouter); +var listenPort = parseInt(process.env.PORT)||3919; +var listenHost = process.env.HOST||"127.0.0.1"; +if(listenHost[0]!="/") { + app.listen(listenPort, listenHost, () => { + console.log(`Listening on ${listenHost}:${listenPort}`); + }); +} +else { + app.listen(listenHost, () => { + console.log(`Listening on ${listenHost} (unix socket)`); + }) +} \ No newline at end of file diff --git a/views/homepage.ejs b/views/homepage.ejs new file mode 100644 index 0000000..3cb05c6 --- /dev/null +++ b/views/homepage.ejs @@ -0,0 +1,9 @@ + + +
+