Dhiraj Shrotri
Full Stack Developer
Big Manchester United fan
Futurama is the best show ever
Likes watching conspiracy videos
vue add apollonpm install --save vue-apollo graphql apollo-boostimport ApolloClient from 'apollo-boost';
import VueApollo from "vue-apollo";
const apolloClient = new ApolloClient({
uri: ''
});
const apolloProvider = new VueApollo({
defaultClient: client
});
Vue.use(VueApollo);npm install --save vue-apollo graphql apollo-client apollo-link apollo-link-http apollo-cache-inmemory graphql-tagimport { ApolloClient } from 'apollo-client'
import { createHttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
const httpLink = createHttpLink({
uri: 'http://localhost:3020/graphql',
})
const cache = new InMemoryCache()
const apolloClient = new ApolloClient({
link: httpLink,
cache,
})import Vue from 'vue'
import VueApollo from 'vue-apollo'
Vue.use(VueApollo)const apolloProvider = new VueApollo({
defaultClient: apolloClient,
})new Vue({
el: '#app',
apolloProvider,
render: h => h(App),
})type Products {
ProductID: String
ProductName: String
Price: Float
ProductImageURL: String
ProductNameShort: String
ProductDescription: String
}type User {
email: String
password: String
FullName: String
PaymentInformation: String
Address: String
UserID: String
}type Orders {
PaymentInformation: String
ShippingInformation: String
TotalPrice: Float
HasOrder: User
}type Query {
User (UserID: String): User
Products: [Products]!
getProduct(ProductID: String): Products
GetAllComponents(ProductID: String): [Products]!,
GetUserOrders (UserID: String): [Orders]!
}type Mutation {
placeOrder(UserID: String, ProductID: String): Message
registerUser(email: String,
password: String,
FullName: String,
PaymentInformation: String,
Address: String): User,
login(email: String,
password: String): User # returns user
}