部署到heroku Express后获得404响应

时间:2019-04-30 18:42:29

标签: node.js reactjs express heroku

我有一个带有后端的快速后端。

文件夹结构为

|-front/

       |package.json
       |index.js

|server.js
|package.json

express位于项目根目录 根package.json脚本是:

  "scripts": {
    "babel-node": "babel-node --presets=env ./server.js",
    "start": "nodemon --exec npm run babel-node -- ./server.js",
    "build": "babel src -d dist",
    "front-install": "yarn --cwd front install",
    "server": "nodemon --exec yarn babel-node",
    "front": "cd ./front && yarn start",
    "dev": "concurrently \"yarn server\" \"yarn front\"",
    "heroku-postbuild":
      "NPM_CONFIG_PRODUCTION=false yarn --cwd front install  && yarn --cwd front build"
  },

react package.json是

 "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

一切都可以在localhost(以dev脚本开始)正常运行,但是部署到heroku后却有404(找不到)

0 个答案:

没有答案