Как разместить сервер nodeJS и отреагировать приложение на героку - PullRequest
0 голосов
/ 08 июля 2019

Я загрузил и сервер, и клиент реакции, но вместо интерфейса реагирования отображается интерфейс сервера.

Я попытался перепутать часть "скриптов" в пакете.Файл json для сервера, но, похоже, это не помогает.

Вот как выглядит package.json для сервера:

{
  "name": "application",
  "version": "0.0.0",
  "private": true,
  "engines": {
    "node": "9.11.2",
    "npm": "6.x"
  },
  "dependencies": {
    "cookie-parser": "~1.4.4",
    "cors": "^2.8.5",
    "csv-parser": "^2.3.0",
    "debug": "~2.6.9",
    "express": "~4.16.1",
    "express-mysql-session": "^2.1.0",
    "express-session": "^1.16.2",
    "http-errors": "~1.6.3",
    "jade": "~1.11.0",
    "md5": "^2.2.1",
    "morgan": "~1.9.1",
    "multer": "^1.4.1",
    "mysql": "^2.17.1",
    "node-stringify": "^0.2.1",
    "xmlbuilder": "^13.0.2"
  },
  "devDependencies": {
    "nodemon": "^1.19.1"
  },
  "scripts": {
    "start": "node ./bin/www",
    "client": "cd frontend && npm start",
    "heroku-postbuild": "cd frontend && npm install && npm run build"
  }
}

А это package.jsonдля клиента (в данном случае веб-интерфейс):

{
  "name": "app-frontend",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@navjobs/upload": "^3.1.3",
    "async-validator": "^1.8.2",
    "axios": "^0.17.0",
    "canvas2pdf": "^1.0.5",
    "express": "^4.16.3",
    "file-exists": "^5.0.1",
    "fs2": "^0.3.4",
    "howler": "^2.0.5",
    "html2canvas": "^1.0.0-alpha.12",
    "js-file-download": "^0.4.7",
    "jspdf": "^1.3.5",
    "moment": "^2.22.1",
    "paginate-array": "^2.0.0",
    "path-exists": "^4.0.0",
    "react": "^16.3.1",
    "react-d3-tree": "^1.13.0",
    "react-dom": "^16.2.0",
    "react-google-login": "^3.0.10",
    "react-helmet": "^5.2.0",
    "react-html-parser": "^2.0.2",
    "react-native": "^0.55.2",
    "react-native-fs": "^2.13.3",
    "react-pagination-table": "^2.0.2",
    "react-redux": "^5.0.6",
    "react-reveal": "^1.2.1",
    "react-router-dom": "^4.2.2",
    "react-router-redux": "^5.0.0-alpha.9",
    "react-scripts": "^2.1.0",
    "react-style-tag": "^2.0.1",
    "react-toastify": "^4.0.0-rc.4",
    "reactable": "^1.1.0",
    "redux": "^3.7.2",
    "redux-logger": "^3.0.6",
    "redux-pack": "^0.1.5",
    "redux-thunk": "^2.2.0",
    "semantic-ui-css": "^2.2.14",
    "semantic-ui-react": "^0.79.1",
    "shape-json": "^1.2.4",
    "styled-components": "^4.3.2",
    "underscore": "^1.9.0",
    "url-exists": "^1.0.3",
    "vis": "^4.21.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "precommit": "lint-staged"
  },
  "devDependencies": {
    "husky": "^0.14.3",
    "lint-staged": "^4.2.3",
    "prettier": "^1.7.2"
  },
  "lint-staged": {
    "*.js": [
      "prettier --tab-width 2 --single-quote --jsx-bracket-same-line --write",
      "git add"
    ]
  },
  "proxy": "http://localhost:3001"
}

А вот моя файловая структура:

.
└── application
    ├── app.js
    ├── assets
    ├── bin
    ├── controllers
    ├── frontend
    │   ├── index.js
    │   ├── package.json (this is the package.json for the frontend)
    │   ├── public
    │   ├── README.md
    │   └── src
    ├── models
    ├── node_modules
    ├── package.json (this is the package.json for the server)
    ├── package-lock.json
    ├── public
    ├── routes
    └── views

Чтобы добавить на всякий случай, мой прослушиватель портов для сервера находится в/bin/www.Я определил порт и затем создал server = createHttpServer(), где серверная переменная - это та, которая прослушивает порт, и она импортируется в app.js.

Если кто-нибудь знает, как исправить мою проблему, пожалуйста, помогитея вышел.Я хочу протестировать развертывание моего приложения в Интернете.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...