码迷,mamicode.com
首页 > 其他好文 > 详细

node(1) hello world

时间:2018-08-06 21:03:05      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:create   listen   style   ext   响应   server   服务器   color   node   

 1 //一 使用require指令来载入http模块
 2 var http = require(‘http‘);
 3 //二使用http.createServer()的方法创建服务器
 4 http.createServer(function(request,response){
 5    //发送HTTP头部
 6    //HTTP状态值:200 
 7    //内容类型:text/plain
 8    responsed.writeHead(200,{‘Content-type‘:‘text/plain‘});
 9 
10    //发送响应数据 “Hellow world”
11    response.end(‘hellow world‘);    
12 }).listen(3000,"127.0.0.1");

 

node(1) hello world

标签:create   listen   style   ext   响应   server   服务器   color   node   

原文地址:https://www.cnblogs.com/webmc/p/9432688.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!