我是新手,刚刚尝试了 Vue.js 和 Graphql。经过一些学习,我用 vue ui(vue cli 3) 搭建了一个项目,为客户端和服务器添加了 vue-cli-plugin-apollo,所以我当前的项目结构如下:
项目文件夹
─┬── apollo-server (server folder)
├── node_modules
├── public
├─┬ src (client folder)
│ └┬─ assets
│ ├─ components
│ ├─ graphql
│ ├─ views
│ ├─ App.vue
│ ├─ main.js
│ ├─ router.js
│ ├─ store.js
│ └─ vue-apollo.js
├── .env
├── package.json
└── vue.config.js
包.json
{
"name": "vue-apollo-graphql",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"apollo": "vue-cli-service apollo:watch --run \"vue-cli-service serve\"",
"apollo:run": "vue-cli-service apollo:run"
},
"dependencies": {
"graphql-import": "^0.7.1",
"graphql-type-json": "^0.2.1",
"lowdb": "^1.0.0",
"merge-graphql-schemas": "^1.5.8",
"mkdirp": "^0.5.1",
"shortid": "^2.2.8",
"vue": "^2.5.17",
"vue-apollo": "^3.0.0-beta.11",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1",
"@vue/cli-plugin-eslint": "^3.0.1",
"@vue/cli-service": "^3.0.1",
"@vue/eslint-config-prettier": "^4.0.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.8.0",
"eslint-plugin-graphql": "^2.1.1",
"eslint-plugin-vue": "^5.0.0-0",
"graphql-tag": "^2.9.0",
"vue-cli-plugin-apollo": "^0.18.0",
"vue-template-compiler": "^2.5.17"
}
}
在本地开发中,npm run apollo
适用于 localhost:8080(client) & localhost:4000/graphql 中的应用程序
所以我的问题是:如何将它们一起部署在 heroku 上?我曾尝试在网上搜索,但信息是零散的,对我来说没有多大意义。任何人都可以给出更清晰的方向来帮助我解决这个问题,以便我可以了解和了解更多相关信息。