Options
All
  • Public
  • Public/Protected
  • All
Menu
     

Class RouteDB

A Route Configurator for DBRequests.

Hierarchy

Implements

Index

Constructors

Handler Properties

Other Properties

Static Methods

Constructors

constructor

Handler Properties

GET

GET: QueryDB

A GET handler for this Data-Route.

POST

POST: QueryDB

A POST handler for this Data-Route.

PUT

PUT: QueryDB

A PUT handler for this Data-Route.

DELETE

DELETE: QueryDB

A DELETE handler for this Data-Route.

Other Properties

Name

Name: string
inheritdoc

Methods

Methods: Array<"GET" | "POST" | "PUT" | "DELETE">

The HTTP-Methods that this Endpoint can be called with. This can be exploited to allow a single-hanlder (GET, for example) repsond to other HMETHODs (such as, POST).

Sub

Sub: string[]

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.

Example:

({
  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"
      }),
    }
  }
});

Links

Links: string[]

A list of Request Paths used for linking RouteDB requests.

Private

Private: boolean

true, if this Endpoint is restricted to Admins.

Static Methods

Static Namespace

  • Namespace(Sub?: String[]): RouteDB
  • A blank RouteDB object, used for Routes that are really just Namespaces for other Routes. These Routes are never actually implemented.

    Parameters

    • Optional Sub: String[]

      A list of the heirarchy the DBRequest belongs under.

    Returns RouteDB

    A RouteDB placeholer.