@morojs/moro / RouteGroup
Class: RouteGroup
Defined in: src/moro.ts:97
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:101
Parameters
prefix
string
app
Returns
RouteGroup
Methods
all()
all(
path,handler,options?):this
Defined in: src/moro.ts:210
Register a handler for all HTTP methods on the given path (Express-compatible).
Parameters
path
string
handler
StaticBody | ((req, res) => any)
options?
any
Returns
this
delete()
Call Signature
delete(
path):RouteBuilder
Defined in: src/moro.ts:153
Parameters
path
string
Returns
RouteBuilder
Call Signature
delete(
path,handler,options?):this
Defined in: src/moro.ts:154
Parameters
path
string
handler
StaticBody | ((req, res) => any)
options?
any
Returns
this
get()
Call Signature
get(
path):RouteBuilder
Defined in: src/moro.ts:111
Parameters
path
string
Returns
RouteBuilder
Call Signature
get(
path,handler,options?):this
Defined in: src/moro.ts:112
Parameters
path
string
handler
StaticBody | ((req, res) => any)
options?
any
Returns
this
group()
group(
prefix,callback):this
Defined in: src/moro.ts:219
Parameters
prefix
string
callback
(group) => void
Returns
this
head()
Call Signature
head(
path):RouteBuilder
Defined in: src/moro.ts:181
Parameters
path
string
Returns
RouteBuilder
Call Signature
head(
path,handler,options?):this
Defined in: src/moro.ts:182
Parameters
path
string
handler
StaticBody | ((req, res) => any)
options?
any
Returns
this
options()
Call Signature
options(
path):RouteBuilder
Defined in: src/moro.ts:195
Parameters
path
string
Returns
RouteBuilder
Call Signature
options(
path,handler,options?):this
Defined in: src/moro.ts:196
Parameters
path
string
handler
StaticBody | ((req, res) => any)
options?
any
Returns
this
patch()
Call Signature
patch(
path):RouteBuilder
Defined in: src/moro.ts:167
Parameters
path
string
Returns
RouteBuilder
Call Signature
patch(
path,handler,options?):this
Defined in: src/moro.ts:168
Parameters
path
string
handler
StaticBody | ((req, res) => any)
options?
any
Returns
this
post()
Call Signature
post(
path):RouteBuilder
Defined in: src/moro.ts:125
Parameters
path
string
Returns
RouteBuilder
Call Signature
post(
path,handler,options?):this
Defined in: src/moro.ts:126
Parameters
path
string
handler
StaticBody | ((req, res) => any)
options?
any
Returns
this
put()
Call Signature
put(
path):RouteBuilder
Defined in: src/moro.ts:139
Parameters
path
string
Returns
RouteBuilder
Call Signature
put(
path,handler,options?):this
Defined in: src/moro.ts:140
Parameters
path
string
handler
StaticBody | ((req, res) => any)
options?
any
Returns
this