您的位置:首页 > Web前端 > Node.js

Node.js学习笔记之一:入门

2015-10-16 13:20 711 查看
关于Node.js这里不再赘述,直接开始学习

第一步下载安装node.js 此处安装window版本

可以在命令行里查看版本

>node -v

编写第一个hello world

编写js文件helloworld.js,代码如下:

var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World,This is my first node js study!\n');}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');[/code] 
使用node运行:



在浏览器访问:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: