I have the following code, for example, throughout my template files:
<link href="http://localhost:3000/css/bootstrap.min.css" rel="stylesheet">
This forces me to change the IP address from http://localhost:3000
to the web server IP address whenever I launch the website. As you can imagine, there are a lot of template files for the whole site. I have written scripts that can search-and-replace the IP instances in the project's template files and I'd like to avoid that if I can.
I'd like to keep the following format:
<link href="css/bootstrap.min.css" rel="stylesheet">
Notice it is independent of the origin. I'd hope there was middlewear that Express could use the current location of the server to serve the files.
I am currently using this code in my server.js
file:
app.use(express.static(path.join(__dirname ,'/v1/public/')));
And works great if I specify the host in the template files. I haven't found any resources online that do what I want to do easily.