Node.js   发布时间:2022-04-24  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Node.js发布http服务大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
2018-11-09 09:43:03   Visit  0

简单服务

@H_301_19@var http = require(\‘http\‘); http.createServer(function (request,responsE) { // 发送 http 头部 // http 状态值: 200 : OK // 内容类型: text/plain response.writeHead(200,{\‘Content-Type\‘: \‘text/plain\‘}); // 发送响应数据 \"Hello World\" response.end(\‘Hello World\\n\‘); }).listen(8888); // 终端打印如下信息 console.log(\‘Server running at http://127.0.0.1:8888/\‘);

 

http静态文件服务

安装http-server

@H_301_19@npm install http-server -g

 

启动服务

@H_301_19@http-server -p 8089

大佬总结

以上是大佬教程为你收集整理的Node.js发布http服务全部内容,希望文章能够帮你解决Node.js发布http服务所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。