Upload server.js with huggingface_hub
Browse files
server.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
import { CommandLineParser } from './src/command-line.js';
|
| 3 |
+
import { serverDirectory } from './src/server-directory.js';
|
| 4 |
+
|
| 5 |
+
console.log(`Node version: ${process.version}. Running in ${process.env.NODE_ENV} environment. Server directory: ${serverDirectory}`);
|
| 6 |
+
|
| 7 |
+
// config.yaml will be set when parsing command line arguments
|
| 8 |
+
const cliArgs = new CommandLineParser().parse(process.argv);
|
| 9 |
+
globalThis.DATA_ROOT = cliArgs.dataRoot;
|
| 10 |
+
globalThis.COMMAND_LINE_ARGS = cliArgs;
|
| 11 |
+
process.chdir(serverDirectory);
|
| 12 |
+
|
| 13 |
+
try {
|
| 14 |
+
await import('./src/server-main.js');
|
| 15 |
+
} catch (error) {
|
| 16 |
+
console.error('A critical error has occurred while starting the server:', error);
|
| 17 |
+
}
|