Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is localhost 3000?

I am new to web development. When I read how to setup react project I see localhost:3000. I searched for it but any of the answers didn't answer what localhost:3000 mean.

like image 477
Dawit Mesfin Avatar asked Aug 18 '20 09:08

Dawit Mesfin


2 Answers

To make you understand this you should understand that you need a web server to host the application to run on the web. Then it will be available for most of the people.

But that application needs to be developed somewhere. In this case you need a local server. There are several local server instances like IIS, Wamp, Xampp and nodejs.

If you are getting started with react then you most probably using react app development with its cli creat-react-app or in short CRA. With this structure and configuration of this app, it is hosted locally in node server and on port 3000.

So, to answer your question. localhost is the address which denotes to 0.0.0.0 or 127.0.0 and it chose the port 3000 you can configure it to other ports too.

So, when you type http://localhost:3000 in the addressbar of the browser you can see the first page hosted from your app. You can make use of etc/hosts file to a local name just like http://localhost:3000 to http://localapp.me too.

like image 157
Jai Avatar answered Oct 15 '22 21:10

Jai


Localhost:3000 is the URL adress at which your web app (during development) is accessible if you started it (with a command in the console, like for example: npm start). Localhost means that it's your computer that is hosting the app, and it doesn't mean that it's accessible on other computers. 3000 is the port at which your web app is accessible, and it can be changed to any 4 digit number from 1000 to 9999 I believe. It's made like that so you can host multiple apps at the same time if you want, at different ports of course. Most production environments have the port set to 3000 by default.

like image 26
ms3300 Avatar answered Oct 15 '22 19:10

ms3300