From ed7a1577f9650c6d5594feb50b947bb149929865 Mon Sep 17 00:00:00 2001 From: "P.O Marec" Date: Thu, 12 Jun 2025 19:30:32 +0200 Subject: [PATCH] Group apiOnly() --- content/docs/basics/routing.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/content/docs/basics/routing.md b/content/docs/basics/routing.md index 7cbc6a5..b8a443f 100644 --- a/content/docs/basics/routing.md +++ b/content/docs/basics/routing.md @@ -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.