mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-17 22:27:19 +00:00
fix(server): add root healthcheck endpoint for Railway deployment
- Add root '/' endpoint that responds with JSON status - Make download routes handle missing installers gracefully - Add error handling around download routes registration - Add logging for download routes initialization Fixes Railway healthcheck failures by ensuring server responds at root path
This commit is contained in:
parent
f099ffd8a6
commit
66ad61b8a0
2 changed files with 27 additions and 4 deletions
|
|
@ -22,9 +22,11 @@ router.get('/desktop', async (req, res) => {
|
|||
|
||||
// Check if file exists
|
||||
if (!fs.existsSync(installerPath)) {
|
||||
console.log('[Download] Installer not found at', installerPath);
|
||||
return res.status(404).json({
|
||||
error: 'Installer not found',
|
||||
message: 'The desktop installer has not been built yet. Please run: npm run build:tauri'
|
||||
error: 'Installer not available',
|
||||
message: 'The desktop installer is not yet available. It will be uploaded soon.',
|
||||
note: 'For development: Run "npm run build:tauri" in shell/aethex-shell to build the installer'
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,21 @@ app.get("/health", (_req, res) => {
|
|||
res.json({ status: "healthy", timestamp: new Date().toISOString() });
|
||||
});
|
||||
|
||||
// Root health check (Railway uses this)
|
||||
app.get("/", (_req, res) => {
|
||||
res.json({
|
||||
status: "online",
|
||||
service: "AeThex OS API",
|
||||
version: "1.0.0",
|
||||
timestamp: new Date().toISOString(),
|
||||
endpoints: {
|
||||
web: "Use client to access web interface",
|
||||
api: "/api/*",
|
||||
download: "/api/download/*"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// API status endpoint (moved from root to /api/status)
|
||||
app.get("/api/status", (_req, res) => {
|
||||
const isKernel = process.env.OPS_Version ? true : false;
|
||||
|
|
@ -132,8 +147,14 @@ app.use((req, res, next) => {
|
|||
|
||||
|
||||
(async () => {
|
||||
// Register download routes
|
||||
// Register download routes (wrapped in try-catch for safety)
|
||||
try {
|
||||
app.use('/api/download', downloadRoutes);
|
||||
log("Download routes registered", "express");
|
||||
} catch (error) {
|
||||
log(`Warning: Failed to register download routes: ${error}`, "express");
|
||||
// Continue anyway - app can work without download routes
|
||||
}
|
||||
|
||||
// Register routes (org middleware applied selectively within routes.ts)
|
||||
await registerRoutes(httpServer, app);
|
||||
|
|
|
|||
Loading…
Reference in a new issue