Skip to content

Commit 5788531

Browse files
committed
release: initial release
0 parents  commit 5788531

21 files changed

+10875
-0
lines changed

.browserslistrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
> 1%
2+
last 2 versions
3+
not dead

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
# local env files
6+
.env.local
7+
.env.*.local
8+
9+
# Log files
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
# Editor directories and files
15+
.idea
16+
.vscode
17+
*.suo
18+
*.ntvs*
19+
*.njsproj
20+
*.sln
21+
*.sw?

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Boilerplate GraphQL Apollo with Factory Method
2+
3+
## Project setup
4+
5+
```
6+
yarn install
7+
```
8+
9+
### Compiles and hot-reloads for development
10+
11+
```
12+
yarn run serve
13+
```
14+
15+
### Compiles and minifies for production
16+
17+
```
18+
yarn run build
19+
```
20+
21+
### Run your tests
22+
23+
```
24+
yarn run test
25+
```
26+
27+
### Lints and fixes files
28+
29+
```
30+
yarn run lint
31+
```

apollo.config.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const path = require('path')
2+
3+
// Load .env files
4+
const { loadEnv } = require('vue-cli-plugin-apollo/utils/load-env')
5+
const env = loadEnv([
6+
path.resolve(__dirname, '.env'),
7+
path.resolve(__dirname, '.env.local')
8+
])
9+
10+
module.exports = {
11+
client: {
12+
service: env.VUE_APP_APOLLO_ENGINE_SERVICE,
13+
includes: ['src/**/*.{js,jsx,ts,tsx,vue,gql}']
14+
},
15+
service: {
16+
name: env.VUE_APP_APOLLO_ENGINE_SERVICE,
17+
localSchemaFile: path.resolve(__dirname, './node_modules/.temp/graphql/schema.json')
18+
},
19+
engine: {
20+
endpoint: process.env.APOLLO_ENGINE_API_ENDPOINT,
21+
apiKey: env.VUE_APP_APOLLO_ENGINE_KEY
22+
}
23+
}

babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "boilerplate-graphql-apollo",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build"
8+
},
9+
"dependencies": {
10+
"core-js": "^3.6.4",
11+
"vue": "^2.6.11",
12+
"vue-apollo": "^3.0.0-beta.11",
13+
"vuex": "^3.1.3"
14+
},
15+
"devDependencies": {
16+
"@vue/cli-plugin-babel": "^4.3.0",
17+
"@vue/cli-service": "^4.3.0",
18+
"graphql-tag": "^2.9.0",
19+
"vue-cli-plugin-apollo": "^0.21.3",
20+
"vue-template-compiler": "^2.6.11"
21+
}
22+
}

public/favicon.ico

4.19 KB
Binary file not shown.

public/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title><%= htmlWebpackPlugin.options.title %></title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13+
</noscript>
14+
<div id="app"></div>
15+
<!-- built files will be auto injected -->
16+
</body>
17+
</html>

src/App.vue

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<template>
2+
<div id="app">
3+
<h1>Boilerplate GraphQL Apollo</h1>
4+
</div>
5+
</template>
6+
7+
<script>
8+
import { repositoryFactory } from "@/repository/repositoryFactory.js";
9+
const charactersRepository = repositoryFactory.get("characters");
10+
const episodesRepository = repositoryFactory.get("episodes");
11+
12+
export default {
13+
name: "Home",
14+
data: () => ({}),
15+
async mounted() {
16+
const character = await charactersRepository.getCharacter({
17+
variables: {
18+
charId: 2
19+
}
20+
});
21+
22+
const characters = await charactersRepository.get({
23+
variables: {
24+
pageIndex: 1
25+
}
26+
});
27+
28+
const episode = await episodesRepository.getEpisode({
29+
variables: {
30+
episodeId: 3
31+
}
32+
});
33+
34+
const episodes = await episodesRepository.get({
35+
variables: {
36+
pageIndex: 3
37+
}
38+
});
39+
}
40+
};
41+
</script>

src/graphql/queries/getCharacter.gql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
query getCharacter($charId: ID = 1) {
2+
character(id: $charId) {
3+
name
4+
}
5+
}

0 commit comments

Comments
 (0)