I have the following code in a file called server.js.
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8124);
console.log('Server running at http://127.0.0.1:8124/');
I use the command prompt and naviage to the folder where the file recides and then the run the command
node server.js
But I don't get the expected output. Instead I get
The node identifier for {My Machine Name} is v2hrfnqaj.
Note: I already have node installed in my machine and it was working fine.
Both your browser JavaScript and Node. js run on the V8 JavaScript runtime engine. This engine takes your JavaScript code and converts it into a faster machine code. Machine code is low-level code which the computer can run without needing to first interpret it.
To check the node server running by logging in to the system In windows you can simply go to the Task Manager and check for node in the application list. If it is there then it is running in the machine.
Explanation. Executing $ node --version command will show the version of Node instance.
You can also prioritize in the environments. Steps: Computer -> Right click -> Properties -> Advanced system settings -> Environment variables -> PATH(in system variables list) -> Edit -> Prioritize by moving up
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With