当我单击hrefs时,页面需要一些时间才能重定向,但最后没有显示,它提示该页面无法正常工作。
我在本地主机上运行该项目,以前使用的链接。下面是导航栏的代码段
// here's your original string
let tOut = `| D| Gbm| G| A|
| D| Gbm| G| A|
| Bm| Gbm| G| D|
| Bm| Gbm| G| A|
| D| Gbm| G| A|
| D| Gbm| G| A|
| Bm| Gbm| G| D|
| Bm| E| G| G A|
| D| Gbm|`
// replace the pipes
tOut = tOut.replace(/^\| ?/mg, '')
console.log(tOut)
// document.write(tOut)
这是我app.js中的代码
/^\|/mg
答案 0 :(得分:0)
我也这样做,并且可以。 您输入了正确的服务器端口吗? 我的是:localhost:3000 / somthing,我的意思是,实际上是相同的代码
const app = express();
app.get('/about', (req, res) => {
res.render('about');
});
也许是问题所在,因为您查看的是文件夹中,但未指定,则为:
app.get('/about', (req, res) => {
res.render('folder/about');
});
也许您没有正确定义布局。
app.set('view engine', 'ejs');