DEV Community

Discussion on: Real time websockets connection 🔥 with Nodejs (Chat App example).

Collapse
 
davidvine profile image
David Vine

Great article!

Small typo though (sorry) ...

In all the example code you've used port 5000 but then, near the end of the article, it says:

"After your React app runs, you should see it at localhost:3000."

Collapse
 
mustafaanaskh99 profile image
Mustafa Anas

Maybe I should have made this more clear.
Here is the thing,
Since the client and the server are two different things, they also run on two different ports.
When you do create-react-app, by default your app (client) will run on port 3000 where as for the server, we choose to run it on port 5000

Collapse
 
davidvine profile image
David Vine

Thanks Mustafa. Apologies, I jumped the gun and hadn't tested it for myself first. 🤦‍♂️

I've run through the process now and did find that the following command doesn't work:

npm create-react-app my_app

The "npm" should be "npx". i.e:

npx create-react-app my_app

For npm use the following command:

npm init react-app my_app

Source: github.com/facebook/create-react-app

Once again, great article!

Thread Thread
 
mustafaanaskh99 profile image
Mustafa Anas

you are so right. I meant type npx. Thanks again!