Skip to content

Instantly share code, notes, and snippets.

View Bensigo's full-sized avatar
🚀

Bensigo Egwey Bensigo

🚀
View GitHub Profile
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 = {
PORT: process.env.PORT || 6060,
DBURI: process.env.DBURI || 'mongodb://localhost:27017/auth',
SECRET: process.env.SECRET || 'bhsvchldjvbscivgjsbnvspiucbvl'
}
module.exports = `
type Query {
hello: String!
}
`
module.exports = {
Query: {
hello (root, args, context) {
return 'Hello world!!'
}
}
}
const {makeExecutableSchema} = require('graphql-tools')
const resolvers = require('./resolvers')
const typeDefs = require('./typeDefs')
module.exports = makeExecutableSchema({
typeDefs,
resolvers
})
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 User = require('./user')
module.exports = {
User
}
module.exports = `
type User {
id: ID!
email: String!
username: String!
password: String!
createAt: String!
}
type Query {
hello : String!
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)
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')