“ Hello World” Node.js Web Server
来源:互联网 发布:asp.net源码下载 编辑:程序博客网 时间:2024/05/25 19:59
var http = require('http');http.createServer(function (req, res) {res.writeHead(200, {'Content-Type': 'text/plain'});res.end('Hello World\n');}).listen(8124, "127.0.0.1");console.log('Server running at http://127.0.0.1:8124/');
这个示例代码首先通过 require 方法把 HTTP 库包含到程序中来。有许多语言都有
包含其他库这一方法, Node 用的是 CommonJS 模块风格。 Node 模块将在第 8 章详
细介绍,当前需要了解的是, HTTP 库所具有的功能已经赋给了 http 对象。
runing hello.js
node hello,js
result:
Server running at http://127.0.0.1:8124/
0 0
- “ Hello World” Node.js Web Server
- node.js hello world
- 【Node.js】Hello World
- node.js Hello world
- Node.js hello world
- Node.js 之"Hello World"
- Node.js之hello world
- Node.js入门:Hello World
- node.js 分析hello world的例子
- Node.js v0.6.18 文档 --Hello World
- Node.js初探之hello world
- node.js + express 初体验【hello world】
- node.js + express 初体验【hello world】
- 玩转Node.js - 01. Hello World!
- node.js 学习笔记001 :Hello,world !
- 创建Node.js的Hello World程序
- 2、Node.js => Hello World
- node.js学习之输出Hello World
- IOS学习(九)UITabView使用及几种常见的创建方式
- HDOJ--1869|六度分离
- 数控车床指令初学
- Java 学习笔记 Day002
- 树梅派1/2/3 编译
- “ Hello World” Node.js Web Server
- UnityGUI系统之EventSystem
- ubuntu14.04安装OpenNI2+驱动XTion PRO Live
- QUTOJ-1359 小菜的难题(二分)
- rapidPHP 1.1.0 - 数据库配置
- rapidPHP 1.1.0 - 数据库表单跟实体配置
- 网页中添加QQ聊天代码
- HDU 2067 小兔的棋盘 (组合数学 卡特兰数)
- 一个关于成员变量的多态问题