我是 Node js 的新手,试图通过一些示例来学习,所以我的要求是我应该在浏览器控制台模式下获得输出,我想通过 HTTP 服务器以及控制台进行检查,但数据仅打印在浏览器页面上但没有得到任何控制台输出。
代码:
require('http').createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Data render at browser page');
console.log('print in browser console ');
}).listen(4000);
Run Code Online (Sandbox Code Playgroud) 我是 Node js 的新手,在浏览一些博客和教程时,我遇到了一种不同的导入模块的方法
对于某些人使用:
const {app} = require('./routes/index');
Run Code Online (Sandbox Code Playgroud)
很少有网站关注:
const app= require('./routes/index');
Run Code Online (Sandbox Code Playgroud)
那么第一和第二之间有什么区别,我真的很困惑,并且没有得到任何正确的解释