Class Route

Represents an arbitrary route relative to an ArangoDB database.

Hierarchy

  • Route

Methods

  • 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>

  • 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>

  • 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>

  • 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>

  • 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>

  • 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>

  • 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>

  • 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