Skip to content

Instantly share code, notes, and snippets.

View jgilbertcastro's full-sized avatar
🎯
Focusing

Jesus Gilbert jgilbertcastro

🎯
Focusing
View GitHub Profile
<router-link to="/">Home</router-link>|
<router-link to="/addpost">New Post</router-link>
import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import AddPost from "../views/AddPost.vue";
Vue.use(VueRouter);
const routes = [
{
path: "/",
<template>
<div>
<div style="text-align: left; width:800px; margin:0 auto;">
<strong>Title</strong>
</div>
<div style="text-align: center; width:800px; margin:0 auto;">
<input style="width:800px" type="text" id="title" name="title" value="" v-model="title" />
</div>
<br />
<div style="text-align: left; width:800px; margin:0 auto;">
<template>
<div>
<div v-for="post in Posts" :key="post.id">
<div style="font-size: 20px; font-weight: 700;">{{ post.title }}</div>
<div style="text-align: justify; width:800px; margin:0 auto;">
<p>
{{ post.description }}
</p>
</div>
<div style="text-align: right; width:800px; margin:0 auto;">
<template>
<div>
<div v-for="post in Posts" :key="post.id">
<div style="font-size: 20px; font-weight: 700;">{{ post.title }}</div>
<div style="text-align: justify; width:800px; margin:0 auto;">
<p>
{{ post.description }}
</p>
</div>
<div style="text-align: right; width:800px; margin:0 auto;">
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
//import apolloclient and vueapollo
import ApolloClient from "apollo-boost";
import VueApollo from "vue-apollo";
Vue.config.productionTip = false;
// define const apolloClient to set graphql api url
@jgilbertcastro
jgilbertcastro / js
Created November 7, 2019 17:18
delete
mutation {
deletePost(id:1)
}
@jgilbertcastro
jgilbertcastro / js
Created November 7, 2019 17:16
update
mutation {
updatePost(
id:2,
title: "Mi segundo Post",
description: "en mi primer post tengo que la vida no es facil",
createDate:"26-09-2019",
author:"Jesus GIlbert"
)
}
@jgilbertcastro
jgilbertcastro / js
Created November 7, 2019 17:14
create
mutation {
createPost(title: "Mi primer Post", description: "en mi primer post tengo que la vida no es facil", createDate:"25-09-2019",author:"Jesus GIlbert") {
id,
title,
description,
createDate,
author
}
}
@jgilbertcastro
jgilbertcastro / js
Created November 7, 2019 17:13
add post
query{
Posts{
id,
title,
description,
createDate,
author
}
}