likhonsheikh commited on
Commit
3e4bd31
·
verified ·
1 Parent(s): c0093fa

Create server.js

Browse files
Files changed (1) hide show
  1. server.js +25 -0
server.js ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const { spawn } = require("child_process");
2
+
3
+ const port = process.env.PORT || 7860;
4
+
5
+ console.log("Starting OpenCode on port:", port);
6
+
7
+ const opencode = spawn("opencode", [
8
+ "web",
9
+ "--host",
10
+ "0.0.0.0",
11
+ "--port",
12
+ port
13
+ ]);
14
+
15
+ opencode.stdout.on("data", (data) => {
16
+ console.log(data.toString());
17
+ });
18
+
19
+ opencode.stderr.on("data", (data) => {
20
+ console.error(data.toString());
21
+ });
22
+
23
+ opencode.on("close", (code) => {
24
+ console.log(`OpenCode exited with code ${code}`);
25
+ });