14.11.3【node.js】做一个最简单的helloworld程序
2014-11-03 12:37
471 查看
//调用http var http = require('http'); http.createServer(function (req, res) { //200是http状态码,比如404是服务器错误,200是正常运行 res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello World\n'); //4000是端口名称 随便写一个数就行 }).listen(4000); //cosole.log是C语言printf的意思,输出,console是控制台 console.log('Server running at port 4000'); //运行此程序在网页上输入 http://localhost:4000/[/code]
相关文章推荐
- node.js写一个简单的helloWorld程序
- 一个简单的基于node.js的TCP服务器和基于C++的TCP客户端通信示例程序
- 如何在Predix上建立一个简单的Node.js 程序
- 如何使用Node.js在Ubuntu上写一个HelloWorld程序
- 使用Node.js + MongoDB实现一个简单的日志分析系统
- Ajax完成一个简单的HelloWorld程序
- 使用webstorm创建一个简单的node.js工程
- nodejs + express + ejs + mongodb 一个非常简单的前后端开发的实例2
- 使用Node.js实现一个简单的FastCGI服务器实例
- 使用Node.js实现一个简单的FastCGI服务器实例
- node.js 一个简单的页面输出
- struts2 一个简单的 struts2程序(HelloWorld)
- [NodeJS]使用Node.js写一个简单的在线聊天室
- Ajax完成一个简单的HelloWorld程序
- Node.js 学习笔记--- (2)创建一个简单的博客工程
- 如何在linux下创建一个简单的JNI程序HelloWorld
- node.js 一个简单的页面输出实现代码
- Js和css文件动态合并------用Node.js开发的一个前端优化小程序
- 详解Node.js API系列 Http模块(1) 构造一个简单的静态页服务器
- Node.js的helloworld 程序