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?
我是一个新手JavaScript程序员,想在我的Mac上使用Node.Js尝试服务器端JavaScript我下载了NodeJs并且向导安装了它,但现在我在我的应用程序中看不到它?
1) How do I open it and start using it? Do I do it from the command line? if so, how do I start?
1)如何打开它并开始使用它?我是否可以从命令行执行此操作?如果是这样,我该如何开始?
2) Can I connect it to a MySQL database I have installed with MAMP?
2)我可以将它连接到我用MAMP安装的MySQL数据库吗?
Thanks if you can help
谢谢,如果你能提供帮助
2 个解决方案
#1
5
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
根据您安装节点的方式,节点的实际位置可能会有所不同。你应该明白这一点。您应该将该路径添加到PATH环境变量中。如果你这样做,那么你可以简单地输入
node scriptname.js
There are plenty of samples around the net. As for mysql connectivity, check this out.
网周围有很多样本。至于mysql连接,请检查一下。
#2
1
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/
我和你在同一条船上,我强烈建议你观看Ryan Dahl在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
在访问SQL的驱动程序方面,您需要安装NPM http://npmjs.org/您可以在MySQL的支持上快速搜索http://search.npmjs.org/。因为node.js对于场景来说还是比较新的,所以你会看到相当多的选择竞争以实现你的目标
#1
5
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
根据您安装节点的方式,节点的实际位置可能会有所不同。你应该明白这一点。您应该将该路径添加到PATH环境变量中。如果你这样做,那么你可以简单地输入
node scriptname.js
There are plenty of samples around the net. As for mysql connectivity, check this out.
网周围有很多样本。至于mysql连接,请检查一下。
#2
1
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/
我和你在同一条船上,我强烈建议你观看Ryan Dahl在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
在访问SQL的驱动程序方面,您需要安装NPM http://npmjs.org/您可以在MySQL的支持上快速搜索http://search.npmjs.org/。因为node.js对于场景来说还是比较新的,所以你会看到相当多的选择竞争以实现你的目标