Skip to content

Group apiOnly() #222

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
15 changes: 15 additions & 0 deletions content/docs/basics/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,21 @@ router
})
```

### Registering API only routes of a group

You can use the `group.apiOnly` to apply `apiOnly` on all its resources.

See also: [Registering API only routes](controllers.md#registering-api-only-routes)


```ts
// title: start/routes.ts
router.group(() => {
router.resource('posts', PostsController)
router.resource('user', UsersController)
}).apiOnly()
```

## Registering routes for a specific domain

AdonisJS allows you to register routes under a specific domain name. This is helpful when you have an application mapped to multiple domains and want different routes for each domain.
Expand Down