Skip to content

Commit 463dcbf

Browse files
committed
docs: update docs
1 parent 72638db commit 463dcbf

File tree

8 files changed

+50
-14
lines changed

8 files changed

+50
-14
lines changed

src/Router/Group.ts

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,13 @@ export class RouteGroup<Context> extends Macroable implements RouteGroupContract
8585
}
8686

8787
/**
88-
* Define Regex matchers for a given param for all the routes
88+
* Define Regex matchers for a given param for all the routes.
89+
*
90+
* @example
91+
* ```ts
92+
* Route.group(() => {
93+
* }).where('id', /^[0-9]+/)
94+
* ```
8995
*/
9096
public where (param: string, matcher: RegExp | string): this {
9197
this.routes.forEach((route) => {
@@ -96,7 +102,13 @@ export class RouteGroup<Context> extends Macroable implements RouteGroupContract
96102
}
97103

98104
/**
99-
* Define prefix all the routes in the group
105+
* Define prefix all the routes in the group.
106+
*
107+
* @example
108+
* ```ts
109+
* Route.group(() => {
110+
* }).prefix('v1')
111+
* ```
100112
*/
101113
public prefix (prefix: string): this {
102114
this.routes.forEach((route) => {
@@ -107,7 +119,13 @@ export class RouteGroup<Context> extends Macroable implements RouteGroupContract
107119
}
108120

109121
/**
110-
* Define domain for all the routes
122+
* Define domain for all the routes.
123+
*
124+
* @example
125+
* ```ts
126+
* Route.group(() => {
127+
* }).domain(':name.adonisjs.com')
128+
* ```
111129
*/
112130
public domain (domain: string): this {
113131
this.routes.forEach((route) => {
@@ -118,7 +136,13 @@ export class RouteGroup<Context> extends Macroable implements RouteGroupContract
118136
}
119137

120138
/**
121-
* Prepend name to the routes name
139+
* Prepend name to the routes name.
140+
*
141+
* @example
142+
* ```ts
143+
* Route.group(() => {
144+
* }).as('version1')
145+
* ```
122146
*/
123147
public as (name: string): this {
124148
this.routes.forEach((route) => {
@@ -129,7 +153,13 @@ export class RouteGroup<Context> extends Macroable implements RouteGroupContract
129153
}
130154

131155
/**
132-
* Prepend an array of middleware to all routes middleware
156+
* Prepend an array of middleware to all routes middleware.
157+
*
158+
* @example
159+
* ```ts
160+
* Route.group(() => {
161+
* }).middleware(['auth'])
162+
* ```
133163
*/
134164
public middleware (middleware: any | any[]): this {
135165
this.routes.forEach((route) => {
@@ -140,7 +170,13 @@ export class RouteGroup<Context> extends Macroable implements RouteGroupContract
140170
}
141171

142172
/**
143-
* Define namespace for all the routes inside the group
173+
* Define namespace for all the routes inside the group.
174+
*
175+
* @example
176+
* ```ts
177+
* Route.group(() => {
178+
* }).namespace('App/Admin/Controllers')
179+
* ```
144180
*/
145181
public namespace (namespace: string): this {
146182
this.routes.forEach((route) => {

src/Router/Resource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { Route } from './Route'
2323
* Learn more http://weblog.jamisbuck.org/2007/2/5/nesting-resources.
2424
*
2525
* @example
26-
* ```js
26+
* ```ts
2727
* const resource = new RouteResource('articles', 'ArticlesController')
2828
* ```
2929
*/

src/Router/Route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { dropSlash } from '../helpers'
2222
* [[Router]] class helper methods.
2323
*
2424
* @example
25-
* ```js
25+
* ```ts
2626
* const route = new Route('posts/:id', ['GET'], async function () {
2727
* })
2828
*

src/Router/Store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { exceptionCodes } from '../helpers'
3030
* for quick lookups.
3131
*
3232
* @example
33-
* ```js
33+
* ```ts
3434
* const store = new Store()
3535
*
3636
* store.add({
@@ -85,7 +85,7 @@ export class Store<Context> {
8585
* matched against the URL to find the appropriate route.
8686
*
8787
* @example
88-
* ```js
88+
* ```ts
8989
* store.add({
9090
* pattern: 'post/:id',
9191
* methods: ['GET'],

src/Router/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ import { toRoutesJSON, exceptionCodes, makeUrl } from '../helpers'
3333
* create route resources.
3434
*
3535
* @example
36-
* ```js
36+
* ```ts
3737
* const router = new Router()
38+
*
3839
* router.get('/', async function () {
3940
* // handle request
4041
* })

src/Server/MiddlewareStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { exceptionCodes } from '../helpers'
3333
* all middleware as plain functions and not `ioc namespaces`.
3434
*
3535
* @example
36-
* ```
36+
* ```ts
3737
* const store = new MiddlewareStore()
3838
*
3939
* store.register([

src/helpers.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,5 @@ export const exceptionCodes = {
141141
E_ROUTE_NOT_FOUND: 'E_ROUTE_NOT_FOUND',
142142
E_INVALID_MIDDLEWARE_TYPE: 'E_INVALID_MIDDLEWARE_TYPE',
143143
E_MISSING_NAMED_MIDDLEWARE: 'E_MISSING_NAMED_MIDDLEWARE',
144-
E_MISSING_CONTROLLER_METHOD: 'E_MISSING_CONTROLLER_METHOD',
145144
E_INVALID_ROUTE_NAMESPACE: 'E_INVALID_ROUTE_NAMESPACE',
146145
}

typedoc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = require('@adonisjs/mrm-preset/_typedoc.js')({
22
exclude: [
33
'**/test/*.ts',
4-
'src/contracts.ts',
4+
'index.ts',
55
],
66
readme: 'none',
77
})

0 commit comments

Comments
 (0)