Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdonisJS integration #1767

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions docs/adonisjs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: AdonisJS Integration
sidebar_label: AdonisJS
---

[`@foadonis/graphql`](https://friendsofadonis.com/docs/graphql) is a fully featured package to build GraphQL APIs with [AdonisJS](https://adonisjs.com/) powered by TypeGraphQL and [Apollo Server](https://www.apollographql.com/docs/apollo-server).

It supports subscriptions out of the box and brings scalars for [Luxon](https://moment.github.io/luxon/#/) and [VineJS](https://vinejs.dev/). It also provide some helpers for authorization to create a seemless experience for building GraphQL APIs.

## Overview

To get started on an existing AdonisJS project a single command is required, it will install all the required dependencies:

```sh
node ace add @foadonis/graphql
```

Once done, you can start your AdonisJS application and access [http://localhost:3000/graphql](http://localhost:3000/graphql) that will great you with the [Apollo Sandbox](https://www.apollographql.com/docs/apollo-sandbox).

You can create your first resolver like so:

```ts
import Recipe from "#models/recipe";
import { Query, Resolver } from "@foadonis/graphql";

@Resolver()
export default class RecipeResolver {
@Query(() => [Recipe])
recipes() {
return Recipe.query();
}
}
```

Register your freshly created resolver in `start/graphql.ts`:

```ts
import graphql from "@foadonis/graphql/services/main";

graphql.resolvers([() => import("#graphql/resolvers/recipe_resolver")]);
```

## Documentation

You can find more information on the [Package Documentation Website](https://friendsofadonis.com/docs/graphql).
8 changes: 8 additions & 0 deletions website/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"previous": "Previous",
"tagline": "Modern framework for GraphQL API in Node.js",
"docs": {
"adonisjs": {
"title": "AdonisJS Integration",
"sidebar_label": "AdonisJS"
},
"authorization": {
"title": "Authorization"
},
Expand Down Expand Up @@ -812,6 +816,10 @@
"title": "Argument and Input validation",
"sidebar_label": "Validation"
},
"version-2.0.0-rc.2/version-2.0.0-rc.2-adonisjs": {
"title": "AdonisJS Integration",
"sidebar_label": "AdonisJS"
},
"version-2.0.0-rc.2/version-2.0.0-rc.2-authorization": {
"title": "Authorization"
},
Expand Down
2 changes: 1 addition & 1 deletion website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"custom-decorators",
"complexity"
],
"Integrations": ["prisma", "nestjs"],
"Integrations": ["prisma", "nestjs", "adonisjs"],
"Others": ["emit-schema", "performance"],
"Recipes": ["browser-usage", "aws-lambda", "azure-functions"]
},
Expand Down
47 changes: 47 additions & 0 deletions website/versioned_docs/version-2.0.0-rc.2/adonisjs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: AdonisJS Integration
sidebar_label: AdonisJS
id: version-2.0.0-rc.2-adonisjs
original_id: adonisjs
---

[`@foadonis/graphql`](https://friendsofadonis.com/docs/graphql) is a fully featured package to build GraphQL APIs with [AdonisJS](https://adonisjs.com/) powered by TypeGraphQL and [Apollo Server](https://www.apollographql.com/docs/apollo-server).

It supports subscriptions out of the box and brings scalars for [Luxon](https://moment.github.io/luxon/#/) and [VineJS](https://vinejs.dev/). It also provide some helpers for authorization to create a seamless experience for building GraphQL APIs.

## Overview

To get started on an existing AdonisJS project a single command is required, it will install all the required dependencies and generate configuration files:

```sh
node ace add @foadonis/graphql
```

Once done, you can start your AdonisJS application and access [http://localhost:3000/graphql](http://localhost:3000/graphql) that will great you with the [Apollo Sandbox](https://www.apollographql.com/docs/apollo-sandbox).

You can create your first resolver like so:

```ts
import Recipe from "#models/recipe";
import { Query, Resolver } from "@foadonis/graphql";

@Resolver()
export default class RecipeResolver {
@Query(() => [Recipe])
recipes() {
return Recipe.query();
}
}
```

Register your freshly created resolver in `start/graphql.ts`:

```ts
import graphql from "@foadonis/graphql/services/main";

graphql.resolvers([() => import("#graphql/resolvers/recipe_resolver")]);
```

## Documentation

You can find more information on the [package documentation website](https://friendsofadonis.com/docs/graphql).
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
],
"Integrations": [
"version-2.0.0-rc.2-prisma",
"version-2.0.0-rc.2-nestjs"
"version-2.0.0-rc.2-nestjs",
"version-2.0.0-rc.2-adonisjs"
],
"Others": [
"version-2.0.0-rc.2-emit-schema",
Expand Down