Skip to content

Commit

Permalink
Add ability to set a bind address on express server
Browse files Browse the repository at this point in the history
  • Loading branch information
Dany9966 committed Jul 22, 2024
1 parent 6e7a634 commit caab88a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import proxyRouter from "./proxies/router";
export default () => {
const app = express();

const PORT = process.env.PORT || 3000;
const PORT = Number(process.env.PORT) || 3000;
const BIND = process.env.BIND || '127.0.0.1'

app.use(express.static("dist"));

Expand All @@ -33,7 +34,7 @@ export default () => {
res.sendFile(path.resolve(__dirname, "../dist", "index.html"));
});

app.listen(PORT, () => {
console.log(`Express server is up on port ${PORT}`);
app.listen(PORT, BIND, () => {
console.log(`Express server is up on ${BIND}:${PORT}`);
});
};

0 comments on commit caab88a

Please sign in to comment.