A list of the heirarchy Endpoints
contained within it's Base
that it belongs under.
By default, any Endpoint
defined within a BasePoint
-- except, of course, for "/"
--
is a direct descendant of "/"
, as "/"
is just the definition of the BasePoint
without
any other paths following it. But obviously there are needs to push the heirarchy further.
Instead of forcing developers to use a Parant > Child
structure that would get very annoying, very
fast, heirarchies are defined using this property. As was said earlier, "/"
, is inherited by all
other Endpoints
contained with a BaseEndpoint
, so it doesn't need to be add here. If the
Endpoint
in question is to remain a direct descendant of "/"
, then this need not be defined.
Depending on whether or not Merge is configured, the path will be resolved differently.
({
User: {
Actions: {
Email: new RouteDB({
Scheme: '/',
Merge: true,
Subs: ['settings'], // defined, child of "Settings", Merge
// Resolves to "/user/settings/:sttg_id/email"
}),
Privacy: new RouteDB({
Scheme: '/:uid/',
Subs: ['settings'], // defined, child of "Settings", no Merge
// Resolves to "/user/settings/privacy/:uid"
}),
Settings: new RouteDB({
Scheme: '/:sttg_id/', ...
// Sub not defined, is child of "/", no Merge
}),
"/": new RouteDB({
Scheme: '/:uid/', ...
// Resolves to "/user/:uid"
}),
}
}
});
A RegexP
, string
-representation of the Route
Path.
global
use: (Auth|Data).Routemethod
use: (Auth|Data).MethodA flag the specifies whether or not, and if so, how to prepend the path-parameters
of the last parent
-Endpoint
referenced in Sub (along with the merge of its own parent
; if applicable) to the path-name/parameters
of this Endpoint
:
true
, the Scheme from the parent
-Endpoint
will be prepended to this Scheme
of this Endpoint
.parent
-Endpoint's
CBRouteAU/CBRouteDB definition of the same HMETHOD. Otherwise, it choose the first
Scheme found within each parent
.method
(see: Uses below), and set to true
, then the system will look for that method
deinition within the parent
and choose that Scheme. Otherwise, the first Scheme found
is chosen.({
User: {
Actions: {
Password: new RouteDB({
Merge: true,
Subs: ['settings','privacy'], // Child of "Settings"
GET: () => ({ ... }), // Merge to "Privacy.GET"
// ^ Resolves to "/user/:uid/settings/privacy/:prv_id/password"
}),
Email: new RouteDB({
Merge: 'POST', // Merge to "Privacy.POST"
Subs: ['settings','privacy'], // Child of "Settings"
GET: () => ({ ... }),
// ^ Resolves to "/user/:uid/settings/privacy/email"
}),
Privacy: new RouteDB({
Scheme: '/:prv_id/', // Defult for any Method defined within
Subs: ['settings'], // Child of "Settings".
Merge: true,
GET: () => ({ ... }),
// ^ Merge to "Settings.GET",
// ^ Resolves to "/user/:uid/settings/privacy/:prv_id"
POST: () => ({ Scheme: '/' })
// ^ Merge to "Settings.GET", Scheme redefined to "/"
// ^ Resolves to "/user/:uid/settings/privacy"
}),
Settings: new RouteDB({
Merge: true,
GET: () => ({ ... }),
// ^ Sub not defined, is child of "/"
// ^ Resolves to "/user/:uid/settings"
}),
"/": new RouteDB({
Scheme: '/:uid/',
GET: () => ({ ... }),
// ^ Resolves to "/user/:uid"
}),
}
}
});
global
: (Auth|Data).Routemethod
: (Auth|Data).MethodA list of Limits
to subscribe to.
global
use: (Auth|Data).Routemethod
use: (Auth|Data).MethodThe documentation for Methods
in this Route
.
global
use: (Auth|Data).Routemethod
use: (Auth|Data).MethodA callback that returns configs for a GET
method within a Route
.
A callback that returns configs for a POST
method within a Route
.
A callback that returns configs for a PUT
method within a Route
.
A callback that returns configs for a DELETE
method within a Route
.
A callback that returns configs for a MID
method within a RouteAU request.
A collection of GNParams, which represent the global
or method
-specific path
/query
/body
parameters of an Endpoint
:
global
use: (Auth|Data).Routemethod
use: (Auth|Data).MethodThese can be defined inline
:
{
async Query() { ... },
Params: {
UserID: new GNParam({
Name: 'User ID',
Default: null,
Format (cls) { return cls.user_id; },
// ...
}),
},
Parse(res) { ... },
}
Or defined in a CFG.PNTS.Defaults object within config/authpoints.cfg.js
or config/endpoints.cfg.js
:
{
__DEFAULTS: {
Header: { ... },
Params: {
// Define as a Default...
UserID: new GNParam({ ... }),
}
},
User: {
Actions: {
Settings: new RouteDB({
Params: {
// ... Reference the default.
UserID: true,
}
}),
},
},
}
When defined using the latter technique, references
to those predefined GNParams are made in the following ways:
Reference | Example | Description |
---|---|---|
Direct |
{ Email: true } |
References the param defined in __DEFAULTS . |
Version |
{ Email: ['REQUIRED'] } |
References a required version of the Email Param. |
true
, if this Endpoint is restricted to Admins.
global
use: (Auth|Data).Routemethod
use: (Auth|Data).Method
Config properties for the
AURequest
object.