Removed commented code
This commit is contained in:
@@ -9,10 +9,8 @@ import './utils/db.js';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import cors from 'cors';
|
||||
// import getUserId from './utils';
|
||||
|
||||
|
||||
import jwt from 'jsonwebtoken';
|
||||
|
||||
const APP_SECRET = 'GraphQL-is-aw3some';
|
||||
|
||||
function getTokenPayload(token) {
|
||||
@@ -60,19 +58,9 @@ const server = new ApolloServer({
|
||||
path.join(__dirname, 'schema.graphql'),
|
||||
'utf8'
|
||||
),
|
||||
// schema,
|
||||
cors: true,
|
||||
playground: process.env.NODE_ENV === 'development' ? true : false,
|
||||
context: ({ req }) => {
|
||||
// if (!db) {
|
||||
// try {
|
||||
// if (!dbClient.isConnected()) await dbClient.connect()
|
||||
// mongo = dbClient.db('Calendar') // database name
|
||||
// console.log(db);
|
||||
// } catch (e) {
|
||||
// console.log('--->error while connecting with graphql context (db)', e)
|
||||
// }
|
||||
|
||||
return {
|
||||
...req,
|
||||
mongoose,
|
||||
@@ -83,23 +71,6 @@ const server = new ApolloServer({
|
||||
: null
|
||||
}
|
||||
},
|
||||
// subscriptions: {
|
||||
// onConnect: (connectionParams) => {
|
||||
// if (connectionParams.authToken) {
|
||||
// return {
|
||||
// mongoose,
|
||||
// userId: getUserId(
|
||||
// null,
|
||||
// connectionParams.authToken
|
||||
// )
|
||||
// };
|
||||
// } else {
|
||||
// return {
|
||||
// mongoose
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
introspection: true,
|
||||
tracing: true,
|
||||
path: '/',
|
||||
@@ -110,7 +81,6 @@ server.applyMiddleware({
|
||||
path: '/',
|
||||
cors: true,
|
||||
onHealthCheck: () =>
|
||||
// eslint-disable-next-line no-undef
|
||||
new Promise((resolve, reject) => {
|
||||
if (mongoose.connection.readyState > 0) {
|
||||
resolve();
|
||||
@@ -124,36 +94,3 @@ app.listen({ port: process.env.PORT }, () => {
|
||||
console.log(`🚀 Server listening on port ${process.env.PORT}`);
|
||||
console.log(`😷 Health checks available at ${process.env.HEALTH_ENDPOINT}`);
|
||||
});
|
||||
|
||||
|
||||
// const { graphqlHTTP } = require('express-graphql');
|
||||
// const mongoose = require("mongoose");
|
||||
// const graphqlSchema = require("./graphql/schema/schema")
|
||||
// const appointmentResolvers = require("./graphql/resolvers/appointment")
|
||||
// const userResolvers = require("./graphql/resolvers/user")
|
||||
|
||||
// var MongoClient = require('mongodb', { useUnifiedTopology: true }).MongoClient;
|
||||
// // import { MongoClient } from 'mongodb'
|
||||
// const Query = require('./resolvers/Query');
|
||||
// const Mutation = require('./resolvers/Mutation');
|
||||
// const Subscription = require('./resolvers/Subscription');
|
||||
// const User = require('./resolvers/User');
|
||||
// const Appointment = require('./resolvers/Appointment');
|
||||
// const Follow = require('./resolvers/Follow');
|
||||
// const fs = require('fs');
|
||||
// const path = require('path');
|
||||
// const { getUserId } = require('./utils');
|
||||
|
||||
// const graphqlResolvers = {
|
||||
// appointmentResolvers,
|
||||
// userResolvers
|
||||
// };
|
||||
|
||||
// // const resolvers = {
|
||||
// // Query,
|
||||
// // Mutation,
|
||||
// // Subscription,
|
||||
// // User,
|
||||
// // Appointment,
|
||||
// // Follow
|
||||
// // };
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
// import Appointment from '../../client/src/components/Appointment.js';
|
||||
import Product from './models/product.js';
|
||||
import Appointment from './models/appointment.js';
|
||||
import User from './models/user.js'
|
||||
// import { createAppointment } from './resolvers/Mutation.js';
|
||||
import bcrypt from 'bcrypt';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
export const resolvers = {
|
||||
Query: {
|
||||
async allAppointments() {
|
||||
return await Appointment.find({ deleted: false })
|
||||
// return await Appointment.find();
|
||||
},
|
||||
async oneAppointment(root, args, context, info) {
|
||||
return await Appointment.findOne({
|
||||
@@ -81,7 +76,6 @@ export const resolvers = {
|
||||
},
|
||||
async deleteAppointment(parent, args, context, info) {
|
||||
return await Appointment.findOneAndUpdate({ _id: args._id }, { deleted: true })
|
||||
// return await Appointment.deleteOne({ _id: args._id });
|
||||
},
|
||||
async createProduct(root, {
|
||||
input
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// const mongoose = require("mongoose");
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
// const dotenv = require("../../.env");
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
dotenv.config();
|
||||
|
||||
Reference in New Issue
Block a user