mac平台下面nodejs环境搭配
2015-06-10 21:20
441 查看
方法一(pkg方式:下载链接http://nodejs.org/dist/v0.12.4/node-v0.12.4.pkg):
官网:https://nodejs.org/download/
例子:
he.js:
官网:https://nodejs.org/download/
例子:
he.js:
var http = require('http'); http.createServer(function(req, res){ res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(8808, '127.0.0.1'); console.log('Server running at ' target='_blank'>http://127.0.0.1:8808');[/code]
启动:adeMacBook-Pro:nodejs_dev apple$ node he.js Server running at http://127.0.0.1:8808[/code]
安装CouchDBsudo brew install couchdb
下载教程:git clone https://github.com/indexzero/nodejs-intro.git[/code]
启动 CouchDB 数据库sudo couchdb
验证:
访问:http://127.0.0.1:5984/_utils/
创建 CouchDB 数据库adeMacBook-Pro:~ apple$ curl -X PUT http://127.0.0.1:5984/pinpoint-dev10 {"ok":true}
你可以在浏览器中访问 http://127.0.0.1:5984/_utils 就可以看到新创建的数据库。
开始教程:
node js 实例使用模块化的方式构建,lib 目录包含很多模块,而服务器脚本在 bin 目录下。
例如,我们要启动 CouchDB 教程,可以在 bin 目录下执行下面命令:./server -t 02couchdb -s
其中 -t 参数允许你指定要执行的 lib 目录下的模块,-s 参数用以设置我们刚建立的 pinpoint-dev 数据库。adeMacBook-Pro:nodejs-intro apple$ ./bin/server -t 02couchdb -s util.puts: Use console.log instead Hello node listening on http://127.0.0.1:8000[/code]
安装http-console:sudo npm install -g http-consoleadeMacBook-Pro:~ apple$ http-console > http-console 0.6.3 > Welcome, enter .help if you're lost. > Connecting to 127.0.0.1 on port 8080. http://127.0.0.1:8080/> POST /bookmarks
相关文章推荐
- Leetcode[19]-Remove Nth Node From End of List
- nodejs全局变量
- nodejs supervisor
- nodejs 运行
- leetcode 25 -- Reverse Nodes in k-Group
- inode、软连接、硬链接
- 让你的 Node.js 应用跑得更快的 10 个技巧(转)
- Remove Nth Node From End of List
- Remove Nth Node From End of List
- Count Complete Tree Nodes || LeetCode1
- Count Complete Tree Nodes || LeetCode
- LeetCode_25---Reverse Nodes in k-Group
- Populating Next Right Pointers in Each Node I or II
- Node.js开发框架Express学习笔记(一)搭建开发环境
- Node.js 调试 GC 以及内存暴涨的分析
- 2015年最佳的15个 Node.js 开发工具
- Node.js学习--基础知识(1)--入门
- NodeJs测试
- NodeJS异常处理uncaughtException篇
- NodeJS异常处理uncaughtException篇