Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

learn: add vue graphql tutorials #2091

Merged
merged 29 commits into from May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
46d32f1
add vue-apollo draft
praveenweb Apr 26, 2019
225a498
add vue tutorials v1
praveenweb Apr 29, 2019
92e042f
update manifests
praveenweb Apr 29, 2019
9803d27
Merge branch 'master' into graphql-tutorials-vue
praveenweb Apr 29, 2019
9c2796b
update readme
praveenweb Apr 29, 2019
24251f5
Merge branch 'master' into graphql-tutorials-vue
praveenweb Apr 30, 2019
571e80b
update dockerfile
praveenweb Apr 30, 2019
a779975
update
praveenweb Apr 30, 2019
aafe355
update maxSurge
praveenweb Apr 30, 2019
59d0eae
readme
praveenweb Apr 30, 2019
e8a2516
update caddy
praveenweb Apr 30, 2019
6ad9b52
update caddy
praveenweb Apr 30, 2019
ee6665c
update remote
praveenweb Apr 30, 2019
7bccd2c
update vue analytics
praveenweb Apr 30, 2019
b5625ef
test
praveenweb Apr 30, 2019
0596add
test
praveenweb Apr 30, 2019
0ef6168
update manifests
praveenweb Apr 30, 2019
055109f
content fixes
praveenweb May 2, 2019
d9f006e
update twitter image
praveenweb May 2, 2019
f30fad1
remove gatsby tutorial site
praveenweb May 4, 2019
d1a3877
update dockerfile
praveenweb May 6, 2019
68a4fb3
move images to cdn
praveenweb May 7, 2019
86a321e
update cdn
praveenweb May 8, 2019
887e945
update vue videos
praveenweb May 10, 2019
9cbd44b
add github links
praveenweb May 10, 2019
5944cae
merge master
praveenweb May 10, 2019
69df7c7
Merge branch 'master' into graphql-tutorials-vue
praveenweb May 10, 2019
b758c4f
update content
praveenweb May 10, 2019
7892268
Merge branch 'master' into graphql-tutorials-vue
praveenweb May 10, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions community/learn/graphql-tutorials/manifests/caddy-config.yaml
Expand Up @@ -10,10 +10,18 @@ data:
/graphql/react/boilerplate.zip https://storage.googleapis.com/graphql-engine-cdn.hasura.io/learn-hasura/react-boilerplate/boilerplate.zip
}

redir 301 {
/graphql/vue/boilerplate.zip https://storage.googleapis.com/graphql-engine-cdn.hasura.io/learn-hasura/vue-boilerplate/boilerplate.zip
}

redir 301 {
/graphql/react/ /graphql/react/introduction
}

redir 301 {
/graphql/vue/ /graphql/vue/introduction
}

redir 301 {
/graphql/hasura/ /graphql/hasura/introduction
}
Expand Down Expand Up @@ -50,6 +58,8 @@ data:

proxy /graphql/react react-apollo

proxy /graphql/vue vue-apollo

proxy /graphql hasura/v1alpha1/graphql {
without /graphql
websocket
Expand Down
Expand Up @@ -15,6 +15,7 @@ spec:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 100%
template:
metadata:
labels:
Expand Down
Expand Up @@ -15,6 +15,7 @@ spec:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 100%
template:
metadata:
labels:
Expand Down
Expand Up @@ -15,6 +15,7 @@ spec:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 100%
template:
metadata:
labels:
Expand Down
46 changes: 46 additions & 0 deletions community/learn/graphql-tutorials/manifests/vue-apollo.yaml
@@ -0,0 +1,46 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: vue-apollo
name: vue-apollo
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: vue-apollo
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 100%
template:
metadata:
labels:
app: vue-apollo
spec:
containers:
- image: hasura/base-git-image:0.7
imagePullPolicy: IfNotPresent
name: vue-apollo
ports:
- containerPort: 8080
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
labels:
app: vue-apollo
name: vue-apollo
namespace: default
spec:
ports:
- port: 80
protocol: TCP
targetPort: 8080
selector:
app: vue-apollo
type: ClusterIP
@@ -0,0 +1,67 @@
import React from "react"
import PropTypes from "prop-types"

export default class HTML extends React.Component {
render() {
return (
<html {...this.props.htmlAttributes}>
<head>
<meta charSet="utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="title" content="A GraphQL course for React developers | Hasura" />
<meta name="description" content="A concise and powerful tutorial that covers fundamental concepts of both GraphQL and using GraphQL in React" />
<meta property="og:title" content="A GraphQL course for React developers | Hasura" />
<meta property="og:description" content="A concise and powerful tutorial that covers fundamental concepts of both GraphQL and using GraphQL in React" />
<meta property="og:image" content="https://storage.googleapis.com/graphql-engine-cdn.hasura.io/learn-hasura/assets/twitter-card-react.png" />
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:title" content="A GraphQL course for React developers | Hasura" />
<meta property="twitter:description" content="A concise and powerful tutorial that covers fundamental concepts of both GraphQL and using GraphQL in React" />
<meta property="twitter:image" content="https://storage.googleapis.com/graphql-engine-cdn.hasura.io/learn-hasura/assets/twitter-card-react.png" />
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossOrigin="anonymous" />
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossOrigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossOrigin="anonymous"></script>
{this.props.headComponents}
</head>
<body {...this.props.bodyAttributes}>
{this.props.preBodyComponents}
<div
key={`body`}
id="___gatsby"
dangerouslySetInnerHTML={{ __html: this.props.body }}
/>
{this.props.postBodyComponents}
<script
dangerouslySetInnerHTML={{
__html: `
$(document).on('click','.navbar-collapse.in',function(e) {
if( $(e.target).is('a') ) {
$(this).collapse('hide');
}
});
`
}}
/>
</body>

</html>
)
}
}

HTML.propTypes = {
htmlAttributes: PropTypes.object,
headComponents: PropTypes.array,
bodyAttributes: PropTypes.object,
preBodyComponents: PropTypes.array,
body: PropTypes.string,
postBodyComponents: PropTypes.array,
}
@@ -0,0 +1 @@
node_modules
@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
@@ -0,0 +1,20 @@
FROM node:carbon

# Create app directory
WORKDIR /app

# Install app dependencies
RUN npm -g install serve
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./

RUN npm install

# Bundle app source
COPY . /app
#Build react/vue/angular bundle static files
RUN npm run build

EXPOSE 8080
# serve dist folder on port 8080
CMD ["serve", "-s", "dist", "-p", "8080"]
@@ -0,0 +1,18 @@
Tutorial
--------

- [Vue](https://learn.hasura.io/graphql/vue/introduction)
- [Hasura GraphQL Endpoint](https://learn.hasura.io/graphql)

Tech stack
----------

- Frontend
- Vue 2.6+
- Vue Apollo

Run the Vue app
---------------

Run `npm run serve` to start the todo app.

@@ -0,0 +1,4 @@
{
"domain": "graphql-tutorials.auth0.com",
"clientId": "P38qnFo1lFAQJrzkun--wEzqljVNGcWW"
}
@@ -0,0 +1,3 @@
module.exports = {
presets: ["@vue/app"]
};