added https withe self sign ssl to backentd and healthcheck to frontend

This commit is contained in:
2025-09-10 22:07:15 +02:00
parent cf072cee0c
commit e7b964078c
12 changed files with 234 additions and 19 deletions

View File

@@ -1,5 +1,8 @@
import dotenv from 'dotenv';
import fs from 'fs';
import https from 'https';
import express from 'express';
import cors from 'cors';
import path from 'path';
import { fileURLToPath } from 'url';
import apiRouter from './api.js';
@@ -12,6 +15,7 @@ const app = express();
db.initDB();
app.use(cors());
app.use(express.json())
app.use(express.urlencoded({ extended: true }))
//app.use(express.static(path.join(__dirname, "public"), {
@@ -19,6 +23,11 @@ app.use(express.urlencoded({ extended: true }))
//}));
app.use("/api", apiRouter);
const server = app.listen(5555, () => {
const options = {
key: fs.readFileSync('server.key'),
cert: fs.readFileSync('server.cert')
};
const server = https.createServer(options, app).listen(5555, () => {
console.log(`Server running on http://localhost:${server.address().port}`);
});