当前第2页 返回上一页
server.js
1 2 3 4 5 6 | var http = require( 'http' );
http.createServer( function (req, res) {
res.writeHead(200, { 'Content-Type' : 'text/plain' });
res.end( 'Hello World\n' );
}).listen(3000, "127.0.0.1" );
console.log( 'Server running at http://127.0.0.1:3000/' );
|
现在使用命令启动node应用程序。
1 2 3 | $ node server.js
debugger listening on port 5858
Server running at http:
|
还可以使用以下命令启用调试来启动应用程序。
1 2 3 4 5 | $ node
Debugger listening on ws://127.0.0.1:9229/8976a32b-cf99-457c-85fb-e7288cbadac6
For help see https://nodejs.org/en/docs/inspector
Server running at http://127.0.0.1:3000/
|
Web服务器已在端口3000上启动。现在在浏览器中访问http://127.0.0.1:3000/url。现在,只需要为应用程序配置前端服务器。
本篇文章到这里就已经全部结束了,更多其他精彩内容可以关注PHP中文网的node.js视频教程栏目!!!
以上就是如何使用PPA在Ubuntu上安装最新的Node.js和NPM的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
2021年值得了解的8个 node.js 框架
使用docker高效部署node.js应用的方法介绍
4个使用将html转换为pdf的方法介绍
谈谈node.js热更新的配置和vscode断点调试
深入浅析node.js异步编程中的callback(回调)
详解node.js buffer的使用
深入浅析node.js 中的多线程和多进程
linux服务器搭建node.js环境的步骤介绍
如何从node.js发送电子邮件
node.js进行调试的几种方法介绍
更多相关阅读请进入《node.js》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » 如何使用PPA在Ubuntu上安装最新的Node.js和NPM