File size: 691 Bytes
5bab120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import "dotenv/config";

import express from "express";

import path from 'path';
import { fileURLToPath } from 'url';

import { env } from "./config.js"
import { Bright, Green, 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(`cobalt wasn't configured yet or configuration is invalid.\n`)
        + Bright(`please run the setup script to fix this: `)
        + Green(`npm run setup`)
    )
}