'Use home network for learning browser-server communcation

I'm really new to html, css, javascript and all kind of web development. After I coded my first own website, I'd like to play a little with communcation between the browser and a server.

I'd like to be able to access a website hosted on my PC (using my PC as "Web" server) over my home network (my router) so that I can load and use it for example on my smartphone. There's no need for it being accessible over the internet, I only want to use it at home when being connected to my WiFi.

Is that possible?



Solution 1:[1]

You can very simply build your own server using Node.js and Express.js.

Here is a simple snippet to create a server on port 8001 on your PC.

const express = require("express");

const app = express();
app.listen(8001, () => {
      console.log("Listening on port 8001");
});

After that, you start building routes, middleware, and static files for your server. More info can be found here and here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1