#!/usr/bin/env node
import { fileURLToPath as __fileURLToPath } from 'url';
import { dirname as __pathDirname } from 'path';
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __pathDirname(__filename);
import express from "express";
import cors from "cors";
const app = express();
const port = process.env.PORT || 3e3;
app.use(cors());
app.use(express.json());
app.get("/", (req, res) => {
  res.json({
    name: "StackMemory Railway Server (Simplified)",
    version: "1.0.0",
    status: "running",
    endpoints: {
      "GET /": "This documentation",
      "GET /health": "Health check",
      "GET /api/test": "Test endpoint"
    }
  });
});
app.get("/health", (req, res) => {
  res.json({
    status: "healthy",
    version: "1.0.0",
    timestamp: (/* @__PURE__ */ new Date()).toISOString(),
    environment: process.env.NODE_ENV || "development",
    port
  });
});
app.get("/api/test", (req, res) => {
  res.json({
    message: "StackMemory Railway Server is running!",
    timestamp: (/* @__PURE__ */ new Date()).toISOString()
  });
});
app.use((err, req, res, _next) => {
  console.error("Error:", err);
  res.status(500).json({
    error: "Internal server error",
    message: err.message
  });
});
app.listen(port, "0.0.0.0", () => {
  console.log(`
\u{1F682} StackMemory Simple Server Started
=====================================
Environment: ${process.env.NODE_ENV || "development"}
Port: ${port}
Health: http://localhost:${port}/health
=====================================
  `);
});
process.on("SIGTERM", () => {
  console.log("SIGTERM received, shutting down gracefully...");
  process.exit(0);
});
process.on("SIGINT", () => {
  console.log("SIGINT received, shutting down...");
  process.exit(0);
});
//# sourceMappingURL=simple.js.map
