Represents an arbitrary route relative to an ArangoDB database.

Methods

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

    Parameters

    • path: string

      Path relative to this route.

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    Example

    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.delete("/users/admin");
  • Performs a DELETE request against the given path relative to this route and returns the server response.

    Parameters

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    Example

    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const user = foxx.roue("/users/admin");
    const res = await user.delete();
  • Performs a GET request against the given path relative to this route and returns the server response.

    Parameters

    • path: string

      Path relative to this route.

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    Example

    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.get("/users", { offset: 10, limit: 5 });
  • Performs a GET request against the given path relative to this route and returns the server response.

    Parameters

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    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 });
  • Performs a HEAD request against the given path relative to this route and returns the server response.

    Parameters

    • path: string

      Path relative to this route.

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    Example

    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.head("/users", { offset: 10, limit: 5 });
  • Performs a HEAD request against the given path relative to this route and returns the server response.

    Parameters

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    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 });
  • Performs a PATCH request against the given path relative to this route and returns the server response.

    Parameters

    • path: string

      Path relative to this route.

    • Optional body: any

      Body of the request object.

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    Example

    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.patch("/users/admin", { password: "admin" });
  • Performs a PATCH request against the given path relative to this route and returns the server response.

    Note: body must not be a string.

    Parameters

    • Optional body: any

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

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    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" });
  • Performs a POST request against the given path relative to this route and returns the server response.

    Parameters

    • path: string

      Path relative to this route.

    • Optional body: any

      Body of the request object.

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    Example

    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.post("/users", {
    username: "admin",
    password: "hunter2"
    });
  • Performs a POST request against the given path relative to this route and returns the server response.

    Note: body must not be a string.

    Parameters

    • Optional body: any

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

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    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"
    });
  • Performs a PUT request against the given path relative to this route and returns the server response.

    Parameters

    • path: string

      Path relative to this route.

    • Optional body: any

      Body of the request object.

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    Example

    const db = new Database();
    const foxx = db.route("/my-foxx-service");
    const res = await foxx.put("/users/admin/password", { password: "admin" });
  • Performs a PUT request against the given path relative to this route and returns the server response.

    Note: body must not be a string.

    Parameters

    • Optional body: any

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

    • Optional search: Record<string, any> | URLSearchParams

      Query string parameters for this request.

    • Optional headers: Headers | Record<string, string>

      Additional headers to send with this request.

    Returns Promise<ArangojsResponse>

    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" });
  • Performs an arbitrary HTTP request relative to this route and returns the server response.

    Parameters

    Returns Promise<ArangojsResponse>

    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"
    }
    });
  • Creates a new route relative to this route that inherits any of its default HTTP headers.

    Parameters

    • path: string

      Path relative to this route.

    • Optional headers: Headers | Record<string, string>

      Additional headers that will be sent with each request.

    Returns Route

    Example

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