From c575dcd0ce1f7996a5ebba868c66b436ef2f0d19 Mon Sep 17 00:00:00 2001 From: redglow Date: Sun, 21 Jun 2026 16:51:35 +0200 Subject: [PATCH] feat: changes for deploy --- README.md | 11 +++++++++++ index.html | 2 +- package.json | 26 +++++++++++++------------- src/server/main.ts | 7 ++++--- tsconfig.json | 3 ++- 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 0daf8fc..45b2324 100644 --- a/README.md +++ b/README.md @@ -16,3 +16,14 @@ All the interface must be protected under authentication EXCEPT for the GET /api ## Compilation and deployment +Compile: + +``` +./node_modules/vite build +``` + +Run: + +``` +NODE_ENV=production HTTP_PORT=1234 node ./src/server/main.ts +``` \ No newline at end of file diff --git a/index.html b/index.html index 110f81d..bd9e843 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - Vite + React + TS + owof Announcements
diff --git a/package.json b/package.json index f7c6c70..d3cb91d 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,17 @@ "biome-full": "biome check --write" }, "dependencies": { + "better-sqlite3": "^12.11.1", + "express": "^5.1.0", + "kysely": "^0.29.2", + "multer": "^2.2.0", + "react": "^19.1.0", + "react-dom": "^19.1.0", + "tsx": "^4.19.3", + "vite-express": "*", + "zod": "^4.4.3" + }, + "devDependencies": { "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.1", "@fontsource/raleway": "5.2.8", @@ -21,19 +32,6 @@ "@tanstack/react-router": "^1.170.16", "@tanstack/react-router-devtools": "^1.167.0", "@tanstack/router-core": "^1.170.0", - "better-sqlite3": "^12.11.1", - "date-fns": "^4.4.0", - "express": "^5.1.0", - "kysely": "^0.29.2", - "multer": "^2.2.0", - "react": "^19.1.0", - "react-dom": "^19.1.0", - "tsx": "^4.19.3", - "typescript": "^5.8.3", - "vite-express": "*", - "zod": "^4.4.3" - }, - "devDependencies": { "@biomejs/biome": "2.5.0", "@tanstack/router-plugin": "^1.168.18", "@types/express": "^5.0.1", @@ -42,7 +40,9 @@ "@types/react": "^19.1.2", "@types/react-dom": "^19.1.2", "@vitejs/plugin-react": "^4.4.1", + "date-fns": "^4.4.0", "nodemon": "^3.1.10", + "typescript": "^5.8.3", "vite": "^6.3.3" } } diff --git a/src/server/main.ts b/src/server/main.ts index cb5039b..ce7c8e0 100644 --- a/src/server/main.ts +++ b/src/server/main.ts @@ -4,7 +4,7 @@ import express from "express"; import multer from "multer"; import ViteExpress from "vite-express"; import z from "zod"; -import { db } from "./db/database.js"; +import { db } from "./db/database.ts"; const baseUploadsFolder = "uploads/"; @@ -131,6 +131,7 @@ app.delete("/api/announcements/:announcementId", async (req, res) => { app.use("/images", express.static(baseUploadsFolder)); -ViteExpress.listen(app, 3000, () => - console.log("Server is listening on port 3000..."), +const httpPort = parseInt(process.env.HTTP_PORT ?? "3000", 10); +ViteExpress.listen(app, httpPort, () => + console.log(`Server is listening on port ${httpPort}...`), ); diff --git a/tsconfig.json b/tsconfig.json index e97c27e..c2e639c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,8 @@ "moduleResolution": "NodeNext", "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true + "noEmit": true, + "allowImportingTsExtensions": true }, "include": ["src"] }