Hello campers,
i have a question. I created a server but the address port 3000 i used is already in use. is it possible i change it to something like 4200port?
attached is the screenshot to my code.
Hello campers,
i have a question. I created a server but the address port 3000 i used is already in use. is it possible i change it to something like 4200port?
attached is the screenshot to my code.
I like to set a variable to the port like: const port = process.env.PORT || 4200
then call server.listen(port)
Just change the port variable from process.env.PORT || 3000
to process.env.PORT || 4200
@austinmoore1492 i did that and its running well and i am wondering both port 3000 and 4200 run on the same thing. i use POSTMAN to generate/see the result of my port (not sure if i explained well) and the all give the same request of “This is my server response”
i killed the server on my terminal and sent the request again using postman and this is what it generated
Try http://localhost:4200
It says it cannot get /:
because that is not a route. Omitting the second colon from the URL should help.
Also instead of res.end("This is my server response!")
do res.send
i know where i was wrong. the port 3000 was the right port but it was running on different terminal. i am using editors terminal and git bash
Be blessed brother:heart_eyes: @austinmoore1492