Nodejs Shortener Code don Chromium工作
我想使我的代码更短。在这种情况下,我将此
const s_html = 'text/html';
const s_png = 'image/png';
const s_jpg = 'image/jpg';
const s_jpeg = 'image/jpeg';
const s_css = 'text/css';
const s_js = 'text/javascript';
缩写功能
function datatype(file, filetype) {
fs.readFile(file, function(err,data){res.writeHead(200, {'Content-Type': filetype}); res.write(data); res.end();})
}
制成了,我允许
case '/static/toolkit.js':
datatype("./static/toolkit.js", "s_js");
break;
在运行代码后进行此操作,我的网站不会显示样式,但是CSS代码可以在Inspect>源中可用
,没有错误或缺少某些内容。后来,我在Firefox上连接我的网站,这是无缝的。
那么那里有什么问题?在我的浏览器中有问题吗?因为我在debian中使用了无聊的铬
I want to make shorter my code. In this case I maked this
const s_html = 'text/html';
const s_png = 'image/png';
const s_jpg = 'image/jpg';
const s_jpeg = 'image/jpeg';
const s_css = 'text/css';
const s_js = 'text/javascript';
My Shortener Function
function datatype(file, filetype) {
fs.readFile(file, function(err,data){res.writeHead(200, {'Content-Type': filetype}); res.write(data); res.end();})
}
After, I allowed to make this
case '/static/toolkit.js':
datatype("./static/toolkit.js", "s_js");
break;
After run my code, My website don't show style but css code is available in Inspect>Source
There is no wrong or missing something. Later on I connect my website on Firefox and it was seamless.
So what's the problem there? Is it problem in my browser? Because I use ungoogled chromium in debian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论