If you have multiple laptops on the same wifi router
, you can access one machine from another by using their private IP address. This is a mild
version of deploying your app on your local network
(or whats called the intranet)
const express = require('express');
const app = express();
const port = 3000;
app.get('/', (req, res) => {
res.send('Hello, World!');
});
app.listen(port, () => {
console.log(`Server is running on <http://localhost>:${port}`);
});
ifconfig or ipconfig
Loopback address
Ethernet 0 network
If I go to 192.168.1.3:3000 on my phone, I should be able to visit the website
You can override what your domain name resolves to by overriding the hosts file.
vi /etc/hosts
127.0.0.01 harkirat.100xdevs.com