我的HTML文件未显示在网页上 [英] My HTML file is not showing on webpage
本文介绍了我的HTML文件未显示在网页上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
server.route({
方法:"GET",
路径:``/关于'',
处理程序:(request,h)=> {
return h.file(''C:/Users/AAKASH/Desktop/New folder/hapiapp/public/to/about'');
}
我尝试过的事情:
先生,我的html文件未显示在网页上,我认为这是我的错误路径,是吗?
server.route({
method:''GET'',
path:''/about'',
handler:(request,h)=> {
return h.file(''C:/Users/AAKASH/Desktop/New folder/hapiapp/public/to/about'');
}
What I have tried:
sir my html file is not showing on webpage, i think it is of path mistake by me, is it so?
推荐答案
使用路径npm模块代替"C:/Users/... about.html",如下行
Hi,
Use path npm module instead of "C:/Users/...about.html" something like as below line
server.route({
method:'GET',
path:'/about',
handler:(request,h)=> {
return h.file(path.join(__dirname, '..', 'public', 'about.html'));
});
这篇关于我的HTML文件未显示在网页上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文