@morojs/moro


@morojs/moro / RouteGroup

Class: RouteGroup

Defined in: src/moro.ts:81

Route group — prefixes all registered paths with a common base path.

Example

app.group('/api/v1', (group) => {
  group.get('/users').handler(getUsersHandler);
  group.post('/users').handler(createUserHandler);
  group.get('/users/:id').handler(getUserHandler);
});

Constructors

Constructor

new RouteGroup(prefix, app): RouteGroup

Defined in: src/moro.ts:85

Parameters

prefix

string

app

Moro

Returns

RouteGroup

Methods

all()

all(path, handler, options?): this

Defined in: src/moro.ts:166

Register a handler for all HTTP methods on the given path (Express-compatible).

Parameters

path

string

handler

(req, res) => any

options?

any

Returns

this


delete()

Call Signature

delete(path): RouteBuilder

Defined in: src/moro.ts:125

Parameters
path

string

Returns

RouteBuilder

Call Signature

delete(path, handler, options?): this

Defined in: src/moro.ts:126

Parameters
path

string

handler

(req, res) => any

options?

any

Returns

this


get()

Call Signature

get(path): RouteBuilder

Defined in: src/moro.ts:95

Parameters
path

string

Returns

RouteBuilder

Call Signature

get(path, handler, options?): this

Defined in: src/moro.ts:96

Parameters
path

string

handler

(req, res) => any

options?

any

Returns

this


group()

group(prefix, callback): this

Defined in: src/moro.ts:171

Parameters

prefix

string

callback

(group) => void

Returns

this


head()

Call Signature

head(path): RouteBuilder

Defined in: src/moro.ts:145

Parameters
path

string

Returns

RouteBuilder

Call Signature

head(path, handler, options?): this

Defined in: src/moro.ts:146

Parameters
path

string

handler

(req, res) => any

options?

any

Returns

this


options()

Call Signature

options(path): RouteBuilder

Defined in: src/moro.ts:155

Parameters
path

string

Returns

RouteBuilder

Call Signature

options(path, handler, options?): this

Defined in: src/moro.ts:156

Parameters
path

string

handler

(req, res) => any

options?

any

Returns

this


patch()

Call Signature

patch(path): RouteBuilder

Defined in: src/moro.ts:135

Parameters
path

string

Returns

RouteBuilder

Call Signature

patch(path, handler, options?): this

Defined in: src/moro.ts:136

Parameters
path

string

handler

(req, res) => any

options?

any

Returns

this


post()

Call Signature

post(path): RouteBuilder

Defined in: src/moro.ts:105

Parameters
path

string

Returns

RouteBuilder

Call Signature

post(path, handler, options?): this

Defined in: src/moro.ts:106

Parameters
path

string

handler

(req, res) => any

options?

any

Returns

this


put()

Call Signature

put(path): RouteBuilder

Defined in: src/moro.ts:115

Parameters
path

string

Returns

RouteBuilder

Call Signature

put(path, handler, options?): this

Defined in: src/moro.ts:116

Parameters
path

string

handler

(req, res) => any

options?

any

Returns

this