cobalt/api/src/cobalt.js
wukko 16c5450d40
Some checks are pending
Run service tests / test service: ${{ matrix.service }} (push) Blocked by required conditions
Run service tests / test service functionality (push) Waiting to run
Run tests / check lockfile correctness (push) Waiting to run
Run tests / web sanity check (push) Waiting to run
Run tests / api sanity check (push) Waiting to run
api/cobalt: update api url error message
2024-10-20 19:07:42 +06:00

26 lines
578 B
JavaScript

import "dotenv/config";
import express from "express";
import path from "path";
import { fileURLToPath } from "url";
import { env } from "./config.js"
import { Red } from "./misc/console-text.js";
const app = express();
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename).slice(0, -4);
app.disable("x-powered-by");
if (env.apiURL) {
const { runAPI } = await import("./core/api.js");
runAPI(express, app, __dirname)
} else {
console.log(
Red("API_URL env variable is missing, cobalt api can't start.")
)
}