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

来源:互联网 发布:淘宝卖家如何开通天猫 编辑:程序博客网 时间:2024/06/11 10:10

关于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/');

使用node运行:



在浏览器访问:





0 0
原创粉丝点击