Reputation: 3468
How do I use NodeJS on Windows? I've downloaded and installed the 0.6.1 MSI.
I can run node in the command prompt.
What do I do next? I can't seem to find much information such as where to put files etc
It's just for a little experimentation.
Thanks
Ric
Upvotes: 3
Views: 1299
Reputation: 3468
I was being an idiot. I was running node at c: then typing the full path to the file within Node! If any one has the same problem then make sure you change to the folder your js files are in first, then node filename.js
Upvotes: 2
Reputation: 124652
Have you followed the basic tutorial exactly as it is posted? If you create a file (let's say, index.js) that looks like this...
var http = require('http');
http.createServer(function(req, res) {
res.writeHead(204, { 'Content-Type':'text/plain'});
res.write('Hello World');
res.end();
}).listen(8080);
...and then launch it via the command line like so (assumes index.js
is visible from the current directory)...
node index.js
...you should see Hello World
in your browser when you point it to http://localhost:8080
.
If you simply run node
then you will get an interactive javascript shell, which is not what you want.
Make sure you called listen(port)
and also make sure that you called res.end()
in order to send the response.
Upvotes: 4