Skip to content

Instantly share code, notes, and snippets.

View Bensigo's full-sized avatar
🚀

Bensigo Egwey Bensigo

🚀
View GitHub Profile
@Bensigo
Bensigo / Button.Vue
Last active February 18, 2020 06:23
<template>
<div>
<div class="demo-wrapper">
<cb-structured section="demo-fields-button" :schema="schema">
<template v-slot:content="props" >
<button :class="props.content.myButton.style" @click="clicked">{{props.content.myButton.label}}</button>
<raw-output :content="props"></raw-output>
</template>
</cb-structured>
</div>
const jwt = require('jsonwebtoken')
const config = require('./config')
module.exports = async req => {
// check for token in headers
const token = req.headers.authorization
try {
const {user} = await jwt.verify(token, config.SECRET)
// asign the user to req.user
req.user = user
const express = require('express')
const bodyParser = require('body-parser')
const mongoose = require('mongoose')
const cors = require('cors')
const {graphiqlExpress, graphqlExpress} = require('apollo-server-express')
const morgan = require('morgan')
// require app modules
const config = require('./config/config')
const schema = require('./graphql')
module.exports = {
Query: {
hello (root, args, context) {
return 'Hello World!!'
}
},
Mutation: {
async createUser (root, args, {DB}) {
const {username, email, password} = args
const user = await DB.User.createUser(email, username, password)
module.exports = `
type User {
id: ID!
email: String!
username: String!
password: String!
createAt: String!
}
type Query {
hello : String!
const User = require('./user')
module.exports = {
User
}
const mongoose = require('mongoose')
const bcryptjs = require('bcryptjs')
const jwt = require('jsonwebtoken')
const config = require('../config/config')
// user schema
const userSchema = new mongoose.Schema({
username: {
type: String,
required: true
},
const {makeExecutableSchema} = require('graphql-tools')
const resolvers = require('./resolvers')
const typeDefs = require('./typeDefs')
module.exports = makeExecutableSchema({
typeDefs,
resolvers
})
module.exports = {
Query: {
hello (root, args, context) {
return 'Hello world!!'
}
}
}
module.exports = `
type Query {
hello: String!
}
`