For the complete documentation index, see llms.txt. This page is also available as Markdown.

Route

Routes are overridden by name and weight, and sorted by priority (desc), then by weight (desc).

class MyRoute {

  @route('GET c_340_ping', {
    name: 'c_340_get',
    weight: 1
  })
  static get({ req, res, body, next, runtime }) {

    return true

  }

  @route({
    weight: 1,
    method: 'POST',
    name: 'c_340_post',
    path: 'c_340_ping',
    acl: 'role.administrator'
  })
  post({ req, res, body, next, runtime }) {

    return body('myData')

  }

}

@route(options)

Arguments

  • options { Object } Options object

    • name { String }

    • type { String }

    • principal { String }

    • environment { String = "*" }

    • weight { Number = 0 }

    • method { String }

    • path { String }

    • authValidation { Object }

    • urlEncoded { String }

    • plainText { String }

    • apiKey { String }

    • priority { Number }

@route(routeIdentity, options)

Arguments

  • routeIdentity { String } A string defining the route method using the format "<method> <path>"

  • options { Object } Options object

    • name { String }

    • type { String }

    • principal { String }

    • environment { String = "*" }

    • weight { Number = 0 }

    • authValidation { Object }

    • urlEncoded { String }

    • plainText { String }

    • apiKey { String }

    • priority { Number }

Method Options

  • methodOptions { Object } Options passed to the method

    • req { Object }

    • res { Object }

    • body { Object }

    • next { Function }

    • runtime { Object }

      • name { String }

      • type { String }

      • principal { String }

      • environment { String = "*" }

      • weight { Number = 0 }

      • configuration { Object }

        • method { String }

        • path { String }

        • authValidation { Object }

        • urlEncoded { String }

        • plainText { String }

        • apiKey { String }

        • priority { Number }

        • acl { String }

      • metadata { Object }

        • resource { String }

        • className { String }

        • methodName { String }

        • static { Boolean }

        • loc { Object }

          • line { String }

          • column { String }

body(key, value)

Accessor for the script API's body

  • key { string } Key associated to a useful value

  • value { Object | number | string | boolean = undefined } If defined, will create an association between the key and value

Example

next(err)

Calls the API route's next method.

  • err { Object = null } Error object

Route Layering

Result

Last updated

Was this helpful?