This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const {ApolloServer, gql} = require('apollo-server') | |
| const typeDefs = gql` | |
| type User { | |
| email: String! | |
| password: String! | |
| } | |
| type Mutation { | |
| imapMutation(email: String!, password: String!): User! | |
| } | |
| ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs'); | |
| const path = require('path'); | |
| const { promisify } = require("util"); | |
| const readFile = promisify(fs.readFile); | |
| const crud = {}; | |
| crud.baseDir = path.join(__dirname,'./database'); | |
| //Write data to a file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Initialize redis and create a client. | |
| const redis = require('redis'); | |
| const client = redis.createClient(); | |
| //Error handler | |
| client.on('error',(err)=>{ | |
| console.log("error",err); | |
| return err; | |
| }); | |
| //Check if errors occured while connecting to the db. | |
| const initializationOptions = { |
NewerOlder