windowsreact-fullstack

can I use WSL2 for fullstack development?


Update 2023 - Apr 13 - : This question does not sound so smart after 2 years of asking. Now that I've understood WSL is actually a linux console and its purpose is not web development. It is better to install native server or tools like docker, WAMP, etc and so on. Apologies if this wastes your time.

// Original Question

I am intrigued by the WSL2 and wondering if I can use it for full stack web development using LAMP, Node or Python. I have a dual boot with linux where I have a lamp stack. My only concern is about displaying the site on a browser. For instance, say that I created a react app in the wsl2 and used visual studio code WSL to manage it. How does this build and show in the browser in wsl2?

Thank you for your solution in advance.

Update 2022/july/07: This question was right when I started using WSL and I was wondering it's implications. I am aware that WSL's IP keeps changing so it is rather a playground than an environment. Thank you for answering this query.


Solution

  • Look here: https://github.com/microsoft/WSL/issues/4392

    You need to force 0.0.0.0 instead of using default 127.0.0.1 to localhost.

    After that you should be able to access website from local PCs browser, since ports inside WSL can be bound locally to your machine.