I use express for my API.(我将express用于我的API。)
I have a folder named app and another folder named server.(我有一个名为app的文件夹和另一个名为server的文件夹。) app is the client app, using create-react-app as boilerplate, while server is express.js app for the API.(app是客户端应用程序,使用create-react-app作为样板,而服务器是API的express.js应用程序。)
in the app.js file of the server, I wrote(在服务器的app.js文件中,我写道)
app.get("*", function (req, res) {
res.sendFile(path.resolve(__dirname, '../app/build/index.html'));
})
But then when I call any API endpoint, I get(但是当我调用任何API端点时,)
You need to enable JavaScript to run this app.(您需要启用JavaScript才能运行此应用。)
in the response.(在回应中。)
I'm confused;(我糊涂了;) what's wrong?(怎么了?)
ask by Jenny Mok translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…