我将PERN堆栈应用程序部署到了heroku。一切正常,但是当我在以下网址刷新页面时-https://earth-nights.herokuapp.com/episode/1-我不再看到页面内容,仅看到API信息:
{
"id": 1,
"title": "Earth Nights #1",
"date_of_show": "April 24, 2020",
"teaser": "Welcome to the first Earth Nights playlist!",
"card_image": "https://cdn.technologynetworks.com/tn/images/thumbs/jpeg/640_360/the-psychedelic-revolution-in-psychiatry-333007.jpg"
}
以下是指向实时应用的链接,如果有帮助的话:https://earth-nights.herokuapp.com/ 通过单击主页上的卡导航到下一页时,它将加载内容,但是刷新该页面后仅显示API信息。
关于为什么会发生这种情况的任何想法吗?
答案 0 :(得分:0)
正如@jon 所说,在前端的 api 调用路由和服务器上的相应路由中添加“/api”。
来自
'/q/:id'
到
'/api/q/:id'