// server.js
import express from "express";
import cors from "cors";
import dotenv from "dotenv";
import dataRoutes from "./routes/dataRoutes.js";
import inventoryRoutes from "./routes/inventoryRoutes.js";
import { LoggingLevel, setLevel, smartLogging } from "./utils/helper.js";

dotenv.config();

const app = express();

app.use(cors());
app.use(express.json());

// Use the itemLookupRoute with a base path, e.g., '/api'
app.use("/api/data", dataRoutes);
app.use("/api/inventory", inventoryRoutes);

//Set Logging Level
setLevel(LoggingLevel.AppTrace); //This should get passed in from the Docker-Compose.
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => smartLogging(LoggingLevel.Logging, `Server running on port ${PORT}`));
