Skip to content

Commit

Permalink
docs: minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Oct 15, 2024
1 parent 1f81c14 commit 272a8cb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
13 changes: 11 additions & 2 deletions docs/content/docs/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ summary: How to use Tuyau RPC / E2E Client in your AdonisJS project

# Client

As mentioned in the [installation](./installation.md), we used `createTuyau` to create our client instance. This instance will be used to make requests to our API. The following options are available:
As mentioned in the [installation](./installation.md), we used `createTuyau` to create our client instance in our frontend application. This instance will be used to make requests to our API, and it will also provide some helpers to generate URLs, check the current route, etc.

Tuyau client is built on top of [Ky](https://github.com/sindresorhus/ky).

## Options

The `createTuyau` function accepts an object with the following options:

### `api`

The `api` object is the generated API definition from your AdonisJS project. This object contains everything needed for Tuyau to work. It contains the routes, the types, the definitions, etc.
Expand Down Expand Up @@ -38,7 +42,12 @@ export const tuyau = createTuyau<{ definition: ApiDefinition }>({
})
```

To clarify, if you don't need to use methods like `tuyau.$url('users.posts.show', { id: 1, postId: 2 })`, `$tuyau.route`, or the `Link` component from `@tuyau/inertia`, you can ignore the `api` object and only pass the `ApiDefinition` type to `createTuyau`.
To clarify, if you don't need to use methods like :
- `tuyau.$url('users.posts.show', { id: 1, postId: 2 })`
- `$tuyau.route(...)`,
- or the `<Link>` component from `@tuyau/inertia`

You can ignore the `api` object and only pass the `ApiDefinition` type to `createTuyau`.

### `baseUrl`

Expand Down
6 changes: 3 additions & 3 deletions docs/content/docs/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
"category": "Guides"
},
{
"permalink": "Client",
"permalink": "client",
"title": "Client",
"contentPath": "./client.md",
"category": "Guides"
},
{
"permalink": "Inertia",
"permalink": "inertia",
"title": "Inertia",
"contentPath": "./inertia.md",
"category": "Guides"
},
{
"permalink": "OpenAPI",
"permalink": "openapi",
"title": "OpenAPI",
"contentPath": "./openapi.md",
"category": "Guides"
Expand Down
4 changes: 4 additions & 0 deletions docs/content/docs/inertia.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
summary: Inertia helpers for AdonisJS, Ziggy-like API for you frontend application.
---

# Inertia package

Tuyau also provides a set of helpers for Inertia projects. The package is called `@tuyau/inertia`. First, make sure to have generated the API definition in your AdonisJS project using `@tuyau/core` and also have configured the client in your frontend project using `@tuyau/client`.
Expand Down
4 changes: 4 additions & 0 deletions docs/content/docs/introduction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
summary: A set of tools to create typesafe APIs with AdonisJS, including an E2E client like tRPC, Inertia helpers, Ziggy-like and more.
---

# Introduction

![](https://static.julr.dev/tuyau.png)
Expand Down

0 comments on commit 272a8cb

Please sign in to comment.