Skip to content

Commit e8cfa7d

Browse files
committed
[client] [hotfix] remove harcoded url, and allow setting host
1 parent 7e938e5 commit e8cfa7d

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

client/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import cookieParser from 'cookie-parser';
88
dotenv.config();
99

1010
const PORT = process.env.PORT || 3000;
11+
const HOST = process.env.HOST || 'localhost';
1112
const server = express();
1213

1314
server.use(cookieParser());
@@ -89,6 +90,6 @@ routes.forEach(([file, route]) => renderEjsAt(file, route));
8990

9091
server.use(express.static('public'));
9192

92-
server.listen(PORT, () => {
93+
server.listen(PORT, HOST, () => {
9394
console.log(`Serving ejs from ${PORT}`);
9495
});

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"type": "module",
33
"scripts": {
44
"tailwind": "npx tailwindcss -i ./public/styles.css -o ./public/vendor/tailwind.css --watch",
5-
"start": "node index.js",
5+
"start": "HOST=0.0.0.0 node index.js",
66
"dev": "nodemon index.js -w views/**/* public/**/*",
77
"fmt": "npx prettier --plugin=prettier-plugin-ejs --write .",
88
"lint": "npx ejs-lint views"

client/views/index.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<%- await include("layouts/header.ejs", {title : "FLUX"}) %>
22

33
<script>
4-
window.location.href = "http://localhost:3001/home";
4+
window.location.href = "/home";
55
</script>
66

7-
<%- await include("layouts/end.ejs") %>
7+
<%- await include("layouts/end.ejs") %>

0 commit comments

Comments
 (0)