码迷,mamicode.com
首页 > Web开发 > 详细

NodeJS学习笔记-创建Web服务

时间:2017-07-06 18:50:33      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:node   running   ejs   stat   end   creates   ext   type   content   

const http = require(‘http‘);

const hostname = ‘127.0.0.11‘;
const port = 7798;

const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader(‘Content-Type‘,‘text/plain‘);
res.end(‘Hello, NodeJS‘);
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});

NodeJS学习笔记-创建Web服务

标签:node   running   ejs   stat   end   creates   ext   type   content   

原文地址:http://www.cnblogs.com/hhsy/p/7115432.html

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