Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node Js how to get started

Tags:

node.js

I'm a newbie JavaScript programmer who wants to experiment with server side JavaScript using Node.Js on my Mac I downloaded NodeJs and the wizard installed it, but now I can't see it in my applications?

1) How do I open it and start using it? Do I do it from the command line? if so, how do I start?

2) Can I connect it to a MySQL database I have installed with MAMP?

Thanks if you can help

like image 511
Leahcim Avatar asked Apr 03 '11 04:04

Leahcim


2 Answers

To start node, you open a terminal and type:

/path/to/node scriptname.js

Depending on how you installed node, the actual location of node may vary. You should figure that out. You should probably add that path to your PATH environment variable. If you do this then you can simply type

node scriptname.js

There are plenty of samples around the net. As for mysql connectivity, check this out.

like image 55
therealjeffg Avatar answered Oct 20 '22 19:10

therealjeffg


I am in pretty much in the same boat as you are, and I highly recommend you to watch the meetup talk by Ryan Dahl on http://nodejs.org/

It is only about an hour long, but it pretty shows you how you can use it for your own non-blocking applications.

In terms of driver for accessing SQL, you will need to install NPM http://npmjs.org/ You can do a quick search http://search.npmjs.org/, on the support for MySQL. Because node.js is still relatively new to the scene, you will see quite a bit of choices competing to meet your goal

like image 35
Antony Avatar answered Oct 20 '22 18:10

Antony