Skip to content

Commit

Permalink
Changed default port number to 3000
Browse files Browse the repository at this point in the history
  • Loading branch information
mmiscool committed Dec 11, 2024
1 parent fd14e20 commit 3b30633
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/apiServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import mime from 'mime'; // Install this package with `npm install mime`
import WebSocket, { WebSocketServer } from 'ws'; // WebSocket support
import { getScriptFolderPath } from './fileIO.js';
import { aiCoderApiFunctions } from './aiCoderApiFunctions.js';
import { readArg } from './terminalHelpers.js';


export let wss;
Expand Down Expand Up @@ -125,7 +126,7 @@ export function setupServer() {
});

// Start the server
const PORT = 5000;
let PORT = readArg("-p") || 3000;
const HOST = '0.0.0.0';
server.listen(PORT, HOST, () => {
console.log(`Server is running at http://localhost:${PORT}`);
Expand Down
10 changes: 10 additions & 0 deletions src/terminalHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,13 @@ export async function printDebugMessage(message) {
}
}




export function readArg(flag) {
const index = process.argv.indexOf(flag);
if (index !== -1 && index + 1 < process.argv.length) {
return process.argv[index + 1];
}
return null; // Return null if the flag or its value is not found
}

0 comments on commit 3b30633

Please sign in to comment.