cobalt/api/src/cobalt.js

28 lines
691 B
JavaScript
Raw Normal View History

import "dotenv/config";
2022-07-08 19:17:56 +01:00
import express from "express";
import path from 'path';
import { fileURLToPath } from 'url';
2022-07-08 19:17:56 +01:00
import { env } from "./config.js"
import { Bright, Green, Red } from "./misc/console-text.js";
const app = express();
2022-07-08 19:17:56 +01:00
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename).slice(0, -4);
app.disable('x-powered-by');
2024-08-02 16:32:00 +01:00
if (env.apiURL) {
const { runAPI } = await import('./core/api.js');
runAPI(express, app, __dirname)
2022-07-08 19:17:56 +01:00
} else {
console.log(
Red(`cobalt wasn't configured yet or configuration is invalid.\n`)
+ Bright(`please run the setup script to fix this: `)
+ Green(`npm run setup`)
)
}