diff --git a/docs/3-how_to_use.mdx b/docs/3-how_to_use.mdx index 642f087..f0b9a97 100644 --- a/docs/3-how_to_use.mdx +++ b/docs/3-how_to_use.mdx @@ -52,11 +52,11 @@ A file to define the context of your GraphQL server. It must default export a fu ```ts // src/context.ts -import { context } from "yoga"; +import { yogaContext } from "yoga"; import { orm } from "./my-orm"; // `context` is an optional helper to provide type-safety and autocompletion -export default context(({ req }) => ({ req, orm })); +export default yogaContext(({ req }) => ({ req, orm })); ``` **`express.ts` (optional)** @@ -65,11 +65,11 @@ A file to access the underlying express instance (and use middlewares, expose we ```ts // src/express.ts -import { express } from "yoga"; +import { yogaExpress } from "yoga"; import { middleware } from "my-express-middleware"; // `express` is an optional helper to provide type-safety and autocompletion -export default express(app => { +export default yogaExpress(app => { // Define any express related logic using the injected `app` express instance app.use(middleware); // app.get('/login', ...) diff --git a/docs/4-configuration.mdx b/docs/4-configuration.mdx index 68f9d85..0e77098 100644 --- a/docs/4-configuration.mdx +++ b/docs/4-configuration.mdx @@ -11,13 +11,15 @@ Most of the opinionated conventions on which Yoga is built can be overriden at a A `yoga.config.ts` file can be created at the root of your project. It must default export an object containing one of the following properties -| Key | Type | Default | Note | -| --------------- | ------------------------ | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `resolversPath` | `string` | `./src/graphql/` | Path to the directory where your resolvers are defined. **If provided, path has to exist.** | -| `contextPath` | `string` | `./src/context.ts` | Path to your `context.ts` file. **If provided, path has to exist.** | -| `ejectFilePath` | `string` | `./src/server.ts` | Path to an `server.ts` file to eject from default configuration `yoga.config.ts`. When provided, all other configuration properties are ignored and should be configured programatically. **If provided, path has to exist.** | -| `output` | `InputOutputFilesConfig` | See below. | Configuration for the outputted files (schema, typings, etc). | -| `prisma` | `InputPrismaConfig` | See below. | Configuration for the Prisma integration. | +| Key | Type | Default | Note | +| --------------- | ------------------------ | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `resolversPath` | `string` | `./src/graphql/` | Path to the directory where your resolvers are defined | +| `contextPath` | `string` | `./src/context.ts` | Path to a file where you can define your GraphQL server context | +| `expressPath` | `string` | `./src/express.ts` | Path to a file where you can access the underlying express instance | +| `typesPath` | `string` | `./src/types.ts` | Path to a file where you can override nexus typescript types used to annotate your GraphQL types | +| `ejectFilePath` | `string` | `./src/server.ts` | Path to a file to eject from the default configuration `yoga.config.ts`. When provided, all other configuration properties are ignored and should be configured programatically. | +| `output` | `InputOutputFilesConfig` | See below. | Configuration for the outputted files (schema, typings, etc). | +| `prisma` | `InputPrismaConfig` | See below. | Configuration for the Prisma integration. | #### InputOutputFilesConfig @@ -39,10 +41,10 @@ A `yoga.config.ts` file that would use all the _default_ options would look like ```ts // yoga.config.ts -import { config } from "yoga"; +import { yogaConfig } from "yoga"; // `config` is just an optional helper to provide type-safety and auto-completion -export default config({ +export default yogaConfig({ resolversPath: "./src/graphql/", contextPath: "./src/context.ts", ejectFilePath: "./src/server.ts",