aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authormaksJopek <72977266+maksJopek@users.noreply.github.com>2021-04-05 00:30:46 +0200
committermaksJopek <72977266+maksJopek@users.noreply.github.com>2021-04-05 00:30:46 +0200
commitd928eab3ecefbf778f1cadece9beac010dc42332 (patch)
tree87722460e8164205a6ec4b381632cfe50195d6f9 /backend
parent292257d627bd1dfeafd772ac6457e2f54c2b73ba (diff)
downloadfia-d928eab3ecefbf778f1cadece9beac010dc42332.tar.gz
fia-d928eab3ecefbf778f1cadece9beac010dc42332.tar.zst
fia-d928eab3ecefbf778f1cadece9beac010dc42332.zip
Small step in good direction
Diffstat (limited to 'backend')
-rw-r--r--backend/ts/helpers.ts18
-rw-r--r--backend/ts/index.ts15
2 files changed, 9 insertions, 24 deletions
diff --git a/backend/ts/helpers.ts b/backend/ts/helpers.ts
deleted file mode 100644
index 984ce2d..0000000
--- a/backend/ts/helpers.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import fetch from "node-fetch";
-
-export async function makeQuery (query: string, params: Array<string>): Promise<string> {
- return await (
- await fetch("https://jopek.eu/maks/szkola/apkKli/fiaFiles/fia.php", {
- method: "POST",
- headers: {
- Accept: "application/json",
- "Content-Type": "application/json"
- },
- body: JSON.stringify({
- apiKey: process.env.API_KEY,
- stmt: query,
- params: params
- })
- })
- ).text();
-} \ No newline at end of file
diff --git a/backend/ts/index.ts b/backend/ts/index.ts
index fd8f8e1..ead29f2 100644
--- a/backend/ts/index.ts
+++ b/backend/ts/index.ts
@@ -7,15 +7,18 @@ dotenv.config();
const app = express();
const PORT = 8000;
-if (!process.env.SESSION_KEY)
- throw Error("SESSION_KEY is undefined");
+if (!process.env.SESSION_KEY) process.env.SESSION_KEY = "ouh2981w1pjd9";
+// throw Error("SESSION_KEY is undefined");
-app.use(session({ secret: process.env.SESSION_KEY, cookie: { maxAge: 60000 } }))
+app.use(
+ session({ secret: process.env.SESSION_KEY, cookie: { maxAge: 60000 } })
+);
app.use("/", express.static("./public"));
-app.get("/favicon.ico", (req, res) => res.redirect("https://lukesmith.xyz/favicon.ico"));
-app.get("/blank", (req, res) => res.send(""));
-app.post("/login", (req, res, next) => login(req, res));
+app.get("/favicon.ico", (req, res) =>
+ res.redirect("https://lukesmith.xyz/favicon.ico")
+);
+app.post("/login", (req, res) => login(req, res));
app.listen(PORT, () => {
console.log(`[server]: Server is running at https://localhost:${PORT}`);