最初,index.ejs模板正在运行,但是突然之间,它无法再呈现该模板。我不知道错误可能在哪里。
我收到错误消息:无法获取/
app.get('/index', function(req, res) {
fs.readFile('items.json', function(error, data) {
if (error) {
res.status(500).end();
} else {
res.render('index.ejs', {
stripePublicKey: stripePublicKey,
items: JSON.parse(data),
});
}
})
})
app.listen(3000);