Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Route

Represents an arbitrary route relative to an ArangoDB database.

Hierarchy

  • Route

Index

Methods

delete

  • delete(path: string, qs?: string | Params, headers?: Headers): Promise<ArangojsResponse>
  • delete(qs?: Params, headers?: Headers): Promise<ArangojsResponse>
  • Performs a DELETE request against the given path relative to this route and returns the server response.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.delete("/users/admin");

    Parameters

    • path: string

      Path relative to this route.

    • Optional qs: string | Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

  • Performs a DELETE request against the given path relative to this route and returns the server response.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const user = foxx.roue("/users/admin");
    const res = await user.delete();

    Parameters

    • Optional qs: Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

get

  • get(path: string, qs?: string | Params, headers?: Headers): Promise<ArangojsResponse>
  • get(qs?: Params, headers?: Headers): Promise<ArangojsResponse>
  • Performs a GET request against the given path relative to this route and returns the server response.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.get("/users", { offset: 10, limit: 5 });

    Parameters

    • path: string

      Path relative to this route.

    • Optional qs: string | Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

  • Performs a GET request against the given path relative to this route and returns the server response.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const users = foxx.route("/users");
    const res = await users.get({ offset: 10, limit: 5 });

    Parameters

    • Optional qs: Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

head

  • head(path: string, qs?: string | Params, headers?: Headers): Promise<ArangojsResponse>
  • head(qs?: Params, headers?: Headers): Promise<ArangojsResponse>
  • Performs a HEAD request against the given path relative to this route and returns the server response.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.head("/users", { offset: 10, limit: 5 });

    Parameters

    • path: string

      Path relative to this route.

    • Optional qs: string | Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

  • Performs a HEAD request against the given path relative to this route and returns the server response.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const users = foxx.route("/users");
    const res = await users.head({ offset: 10, limit: 5 });

    Parameters

    • Optional qs: Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

patch

  • patch(path: string, body?: any, qs?: string | Params, headers?: Headers): Promise<ArangojsResponse>
  • patch(body?: any, qs?: string | Params, headers?: Headers): Promise<ArangojsResponse>
  • Performs a PATCH request against the given path relative to this route and returns the server response.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.patch("/users/admin", { password: "admin" });

    Parameters

    • path: string

      Path relative to this route.

    • Optional body: any

      Body of the request object.

    • Optional qs: string | Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

  • Performs a PATCH request against the given path relative to this route and returns the server response.

    Note: body must not be a string.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const user = foxx.route("/users/admin")
    const res = await user.patch({ password: "admin" });

    Parameters

    • Optional body: any

      Body of the request object. Must not be a string.

    • Optional qs: string | Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

post

  • post(path: string, body?: any, qs?: string | Params, headers?: Headers): Promise<ArangojsResponse>
  • post(body?: any, qs?: string | Params, headers?: Headers): Promise<ArangojsResponse>
  • Performs a POST request against the given path relative to this route and returns the server response.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.post("/users", {
      username: "admin",
      password: "hunter2"
    });

    Parameters

    • path: string

      Path relative to this route.

    • Optional body: any

      Body of the request object.

    • Optional qs: string | Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

  • Performs a POST request against the given path relative to this route and returns the server response.

    Note: body must not be a string.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const users = foxx.route("/users");
    const res = await users.post({
      username: "admin",
      password: "hunter2"
    });

    Parameters

    • Optional body: any

      Body of the request object. Must not be a string.

    • Optional qs: string | Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

put

  • put(path: string, body?: any, qs?: string | Params, headers?: Headers): Promise<ArangojsResponse>
  • put(body?: any, qs?: string | Params, headers?: Headers): Promise<ArangojsResponse>
  • Performs a PUT request against the given path relative to this route and returns the server response.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.put("/users/admin/password", { password: "admin" });

    Parameters

    • path: string

      Path relative to this route.

    • Optional body: any

      Body of the request object.

    • Optional qs: string | Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

  • Performs a PUT request against the given path relative to this route and returns the server response.

    Note: body must not be a string.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const password = foxx.route("/users/admin/password");
    const res = await password.put({ password: "admin" });

    Parameters

    • Optional body: any

      Body of the request object. Must not be a string.

    • Optional qs: string | Params

      Query string parameters for this request.

    • Optional headers: Headers

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

request

  • Performs an arbitrary HTTP request relative to this route and returns the server response.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.request({
      method: "POST",
      path: "/users",
      body: {
        username: "admin",
        password: "hunter2"
      }
    });

    Parameters

    • Optional options: RequestOptions

      Options for performing the request.

    Returns Promise<ArangojsResponse>

route

  • Creates a new route relative to this route that inherits any of its default HTTP headers.

    example
    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const users = foxx.route("/users");

    Parameters

    • path: string

      Path relative to this route.

    • Optional headers: Headers

      Additional headers that will be sent with each request.

    Returns Route

Generated using TypeDoc