added creation of default admin user and login. TODO authenticate with session token

This commit is contained in:
2025-10-02 11:23:15 +02:00
parent f99aee302a
commit 2bae9db84f
6 changed files with 181 additions and 10 deletions

View File

@@ -1,8 +1,11 @@
import dotenv from "dotenv";
dotenv.config();
import express from "express";
import expressWs from "express-ws";
import morgan from "morgan";
import { initWebsocket } from "./websocket.js";
import { initAuth } from "./auth.js";
import { close as closeDbConnection, initDbConnection } from "./db.js";
import { close as closeDbConnection, initDbConnection, db } from "./db.js";
const app = express();
const appWs = expressWs(app);
const port = 12345;
@@ -13,9 +16,12 @@ process.on('exit', function() {
closeDbConnection();
});
app.use(morgan(process.env.production ? 'common' : 'dev'));
app.use(express.json());
await initDbConnection();
initAuth(app);
initAuth(app, db);
initWebsocket(app);
app.listen(port, () => {