nodeJS/ test my js file

I wrote the next try.js file

var net = require('net')

function create(r){
    var server = net.createServer(function(socket) {
        socket.write('hello\n');
        socket.end('world\n');
        });
    server.listen(8000);
}

and I want to check if this function works well. So I want to excute it, and then go to localhost:8000 and check if I get the Hello massage. I try to go to dictionary of the try.js file via the node console, but I don't see any option for to do this.

the way you execute a nodejs app is by commandline
node try.js
then you can navigate to localhost:8000 but what you made there arnt a http server so browsers arnt going to get the response. telenet should give you the response 'hello world'. but more likely youre after the http insted of net server