例如,如果浏览器禁用了 javascript,node.js 仍然可以工作还是需要后备?
我知道这可能是一个愚蠢的问题,但我试图向 friend 证明 Node.js 在服务器端工作并且不依赖于客户端。
最佳答案
正如 @frédéric-hamidi 所指出的,运行一个 Node 服务器,然后 curl 它:
nodejs
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('I don\'t need js on the browser!');
}).listen(80);
外壳
curl http://web-07081482-2b2c-4e1b-9b1c-9ab20dccb92c.runnable.com/
你可以向他展示这个演示:
http://runnable.com/VM9-XCkU5E06W8gl/nodejs-so-for-node-js-and-hello-world
关于javascript - Node.js - 禁用浏览器的 Javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28278630/