Completely new to node.js

98 views
Skip to first unread message

csharp

unread,
Jun 3, 2012, 11:35:20 PM6/3/12
to nodejs, csharp...@gmail.com
Hello,

I had heard that there was server-side JavaScript, but knew nothing
about it until today when I found the websites:
http://www.hongkiat.com/blog/node-js-server-side-javascript/ and
http://nodejs.org/

I downloaded v0.6.18 onto my Windows Vista computer from the second
link and got the console prompt to work.

On type something like:
var a = 5;
var b = 6;
a + b;

I get the message "undefined" after the first two lines, but it still
works and gives the result as 11.

If I replace the last line by console.log(a+b);

I also get 11, but this is again followed by "undefined". Why am I
getting these messages?

Of rather more significance, if I create a file called helloworld.js,
and put in the file the line console.log("Hello World"); then type
"node helloworld.js", the prompt displays "..." then hangs, as if it
is waiting for something more, and cannot find the file. On typing
process.cwd() I am sure I am in the correct directory with the test
file.

Is there some path that has to be set so that Node can find the test
file, and how do I get rid of the "undefinded" replies?

Node looks very interesting, but until these issues are resolved, I
cannot move on, and would be most grateful for some help.

csharp.com

Graeme Foster

unread,
Jun 4, 2012, 4:20:59 AM6/4/12
to nod...@googlegroups.com
You need to run "node.exe helloworld.js" from your Windows command prompt rather then the REPL that node.exe on its own gives you.

You are seeing "undefined" when you enter a statement that does not evaluate to a value; "undefined" is saying there is no value to display.

Good luck!
G.
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en


--
--
Graeme Foster

csharp

unread,
Jun 4, 2012, 12:12:03 PM6/4/12
to nodejs
OK, many thanks, I tried that out and it works!

I knew it must have been something very simple that I was missing, but
wish the documentation had been a bit clearer.

csharp
> > To post to this group, send email to nod...@googlegroups.com<javascript:;>
> > To unsubscribe from this group, send email to
> > nodejs+un...@googlegroups.com <javascript:;>

Angel Java Lopez

unread,
Jun 4, 2012, 12:27:50 PM6/4/12
to nod...@googlegroups.com

Christopher Sharp

unread,
Jun 4, 2012, 1:22:37 PM6/4/12
to nod...@googlegroups.com
Many thanks indeed for the links to the documentation, and I just
managed to get a simple example of a web server to run.

csharp

Angel Java Lopez

unread,
Jun 4, 2012, 1:34:09 PM6/4/12
to nod...@googlegroups.com
Great!

A jump, but interesting (it works on Windows out of the box) to show the power of Node! ;-) to impress your boss or a .Net developer audience:

In any directory, run:

npm install -g jake geddy

The -g flag indicates a global install (your directory is not affected)

From a working directory, then run

geddy app todo_app

A new directory was created

cd todo_app
geddy


Node ecosystem is full of such surprises ;-)

The details:

José F. Romaniello

unread,
Jun 4, 2012, 1:53:15 PM6/4/12
to nod...@googlegroups.com

2012/6/4 Angel Java Lopez <ajlop...@gmail.com>



Node ecosystem is full of such surprises ;-)


 Nice to see two c# devs, Angel and Graeme, answering to guy nick named Csharp, Angel sending links to my friend and coworker Gustavo (also c# dev) and then the icing on the cake, another csharp-er to *notice all this :)

maybe in few months we can beat phpers in node.js :P

Christopher Sharp

unread,
Jun 4, 2012, 1:54:59 PM6/4/12
to nod...@googlegroups.com
Fantastic, now I have another interesting link - many thanks!

As it happens, I just fired off an e-mail to a friend who is involved
with programming mobile devices.

Less than 24 hours ago I hardly heard of server-side JavaScript, and
had never heard that node.js even existed. It was through looking at
HTML 5 and links on writing games with JavaScript that I came across
all this.

csharp

Angel Java Lopez

unread,
Jun 4, 2012, 2:07:41 PM6/4/12
to nod...@googlegroups.com
Ah! Games!

Related to Azure, but it could be adapted to ASP.NET MVC + Node.js:

specially
http://msdn.microsoft.com/en-us/hh779680 adding Node.js for multiplayer support

Old explanation (related to 1.1.1 version of social game example)

My links about Node.js and game development

Christopher Sharp

unread,
Jun 4, 2012, 5:38:22 PM6/4/12
to nod...@googlegroups.com
OK, lots more information, many thanks.

I've just tried to script a script, i.e. get node.js to generate a
page which includes client-side HTML and JavaScript, with the
client-side JavaScript using AJAX calls, but it does not seem to work
properly. I know the AJAX works correctly on its own using the
docroot container in Glassfish.

Incidentally, I own the domain name csharp.com, but missed getting
csharp.net when it became available.

csharp
Reply all
Reply to author
Forward
0 new messages