diff --git a/.forgejo/workflows/prettier.yml b/.forgejo/workflows/prettier.yml new file mode 100644 index 0000000..01a580b --- /dev/null +++ b/.forgejo/workflows/prettier.yml @@ -0,0 +1,13 @@ +on: + push: + pull_request: + types: [opened, synchronize, reopened] +jobs: + prettier: + runs-on: docker + steps: + - uses: actions/checkout@v3 + - id: dependencies + run: NODE_ENV=development npm ci + - id: prettier + run: npx prettier --check . diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..78664b2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.tabSize": 2 +} diff --git a/README b/README index eb6fc27..d305afe 100644 --- a/README +++ b/README @@ -2,4 +2,4 @@ This is a random project of mine that I spontaneously decided to start working o I did something like this in the past, but I have no idea what happened to it, and it's not public, so let's just call this one the first. Feel free to contribute if you want :) In case you're wondering what this is going to be: - I'm trying to create a website that lets people submit questions and associated answers to it for others to see. In other words, a FAQ website :) \ No newline at end of file +I'm trying to create a website that lets people submit questions and associated answers to it for others to see. In other words, a FAQ website :) diff --git a/helpers/database.js b/helpers/database.js index 6ca4370..c957ceb 100644 --- a/helpers/database.js +++ b/helpers/database.js @@ -1,3 +1,3 @@ import { PrismaClient } from "@prisma/client"; const prisma = new PrismaClient(); -export default prisma; \ No newline at end of file +export default prisma; diff --git a/package-lock.json b/package-lock.json index 00f2935..5fcb16e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "devDependencies": { "@types/express": "^4.17.21", "@types/node": "^20.14.10", + "prettier": "^3.3.2", "prisma": "^5.16.1" } }, @@ -657,6 +658,21 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, + "node_modules/prettier": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", + "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/prisma": { "version": "5.16.1", "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.16.1.tgz", diff --git a/package.json b/package.json index 3e04c28..0876ada 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "devDependencies": { "@types/express": "^4.17.21", "@types/node": "^20.14.10", + "prettier": "^3.3.2", "prisma": "^5.16.1" }, "bin": { diff --git a/public/primary.css b/public/primary.css index ec2f93f..4b9521c 100644 --- a/public/primary.css +++ b/public/primary.css @@ -1,3 +1,3 @@ :root { - color-scheme: light dark; -} \ No newline at end of file + color-scheme: light dark; +} diff --git a/routes/index.js b/routes/index.js index 09a4ad1..9526236 100644 --- a/routes/index.js +++ b/routes/index.js @@ -3,4 +3,4 @@ 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 +export default faqRouter; diff --git a/routes/static.js b/routes/static.js index d1b94a5..271b3b6 100644 --- a/routes/static.js +++ b/routes/static.js @@ -1,4 +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 +export default staticRouter; diff --git a/server.js b/server.js index 8d0189c..eada801 100644 --- a/server.js +++ b/server.js @@ -2,15 +2,14 @@ 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}`); - }); +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)`); + }); } -else { - app.listen(listenHost, () => { - console.log(`Listening on ${listenHost} (unix socket)`); - }) -} \ No newline at end of file