mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-16 17:16:19 +00:00
feat: implement basic file watcher and session updater
This commit is contained in:
@@ -1,6 +1,37 @@
|
||||
import express from 'express';
|
||||
import http from 'http';
|
||||
|
||||
import { userDb } from "@/shared/database/repositories/users.js";
|
||||
import { initializeDatabase } from '@/shared/database/init-db.js';
|
||||
import { initializeWatcher } from '@/modules/watcher/file-watcher.js';
|
||||
|
||||
console.log("----------------Hello there, Refactored Runner!-------------------");
|
||||
|
||||
console.log("User db initialized");
|
||||
console.log("First user:", userDb.getFirstUser());
|
||||
const app = express();
|
||||
const server = http.createServer(app);
|
||||
|
||||
const serverPortEnv = process.env.SERVER_PORT;
|
||||
const SERVER_PORT = serverPortEnv ? Number.parseInt(serverPortEnv) : 3001;
|
||||
|
||||
if (Number.isNaN(SERVER_PORT)) {
|
||||
throw new Error(`Invalid SERVER_PORT value: ${serverPortEnv}`);
|
||||
}
|
||||
const HOST = process.env.HOST || '0.0.0.0';
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
await initializeDatabase();
|
||||
|
||||
server.listen(SERVER_PORT, HOST, async () => {
|
||||
console.log(`Server is running on http://${HOST}:${SERVER_PORT}`);
|
||||
|
||||
await initializeWatcher();
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error("Failed to initialize database:", error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
await main();
|
||||
Reference in New Issue
Block a user