'Best Practice for Folder Structure For Resolvers and TypeDefs resolve ambiguity
I am working on best practices for folder structure on an apollo-graphql project. Right now I have a graphql folder that contains both a Resolvers and Schema Folder, this is to keep everything separate. However, Within my Resolvers folder I want a new Typescript file for each Typedef. (See photo)
[![enter image description here][2]][2]
However, in my Index file I put in this
/src/graphql/resolvers/index.ts
export *from "./Category"
export * from "./Product"
However, I get the following error "./Category" has already exported a member named 'resolvers'. Consider explicitly re-exporting to resolve the ambiguity."
What is the best way to approach this issue so that I can have everything separated out, but still only have to import one line into my ApolloServer
src/index.ts
import { ApolloServer } from 'apollo-server'
import { context } from './graphql/context'
import {typeDefs} from "./graphql/Schema/index"
import {resolvers} from "./graphql/resolvers/index"
new ApolloServer({ resolvers, typeDefs, context: context }).listen(
{ port: 4000 },
() =>
console.log(`
🚀 Server ready at: http://localhost:4000`))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

