node.js基础
2017-06-07 本文已影响1人
ZhongQw
创建第一个应用——hello world!
var http=require('http');
http.createServer(function(request,response) {
respose.write.Head(200,{'Content-Type': 'text/plain'});
response.end('Hello World\n');
}).listen(8888);
console.log('Server running at http://127.0.0.1:8888/');
- http的常见的状态码为:
200 - 服务器成功返回网页
404 - 请求的网页不存在
503 - 服务器超时
REPL 命令 - ctrl + c - 退出当前终端。
- ctrl + c 按下两次 - 退出 Node REPL。
- ctrl + d - 退出 Node REPL.
- 向上/向下 键 - 查看输入的历史命令
- tab 键 - 列出当前命令
- help - 列出使用命令
- break - 退出多行表达式
- clear - 退出多行表达式
- save filename - 保存当前的 Node REPL 会话到指定文件
- load filename - 载入当前 Node REPL 会话的文件内容。