Download api/src/cobalt.js from Dieiol919/cobalt: direct link, hf CLI and curl.
- Browser
- Download file 857 Bytes
-
https://huggingface.co/Dieiol919/cobalt/resolve/main/api/src/cobalt.js
- Command line
-
hf download hf://Dieiol919/cobalt/api/src/cobalt.js
-
curl -L -o cobalt.js https://huggingface.co/Dieiol919/cobalt/resolve/main/api/src/cobalt.js
857 Bytes
| import "dotenv/config"; | |
| import express from "express"; | |
| import cluster from "node:cluster"; | |
| import path from "path"; | |
| import { fileURLToPath } from "url"; | |
| import { env, isCluster } from "./config.js" | |
| import { Red } from "./misc/console-text.js"; | |
| import { initCluster } from "./misc/cluster.js"; | |
| import { setupEnvWatcher } from "./core/env.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"); | |
| if (isCluster) { | |
| await initCluster(); | |
| } | |
| if (env.envFile) { | |
| setupEnvWatcher(); | |
| } | |
| runAPI(express, app, __dirname, cluster.isPrimary); | |
| } else { | |
| console.log( | |
| Red("API_URL env variable is missing, cobalt api can't start.") | |
| ) | |
| } | |