You're viewing **Apigee Edge** documentation.  
[Go to the
**Apigee X** documentation](http://cloud.google.com/apigee/docs). info

> [!WARNING]
> **Private Cloud Deprecation Notice:**
>
> **Support for [Node.js](https://docs.apigee.com/api-platform/nodejs/overview-nodejs-apigee-edge) proxies
> and [secure vaults](https://docs.apigee.com/api-platform/nodejs/using-secure-store)**
>
> Since 2013, Apigee has supported the
> [use of Node.js proxies within Apigee
> Edge](https://www.programmableweb.com/news/apigee-api-platform-now-supports-node.js-allowing-developers-to-build-highly-customized-apis-and-apps/brief/2013/10/25) through the use of [Trireme](https://github.com/apigee/trireme), which enables you to run your Node.js code
> within Apigee Edge for Private Cloud and expose it as an API.
>
>
> Apigee recommends Private Cloud customers take the following steps:
>
> - Migrate data in secure vaults to [Encrypted Key Value Maps](https://docs.apigee.com/api-platform/cache/key-value-maps#aboutencrypted) (KVM) to access sensitive data from an API proxy.
> - Migrate Trireme (Node.js) based API proxies to a native Node.js environment outside of Apigee.
>
>
> See also [Apigee deprecations and retirements](https://docs.apigee.com/release/deprecated-features).

> [!WARNING]
> **Public Cloud Retired feature:** The traditional, Trireme-based
> Node.js support on Apigee Edge Cloud is retired and, by extension,
> [apigee-access](https://docs.apigee.com/api-platform/nodejs/using-apigee-access) is also
> retired because it is only used in Trireme-based Node.js applications deployed on Apigee Edge.
> Trireme-based Node.js was retired on October 10, 2019. See
> [Trireme-based Node.js End of Life](https://docs.apigee.com/release/notes/trireme-nodejs-eol).

The `apigee-access` module lets you access API proxy flow variables and caches from
within Node.js application code. The module is included with the Apigee Edge platform; you do not
need to install it as you would with other Node.js modules.

## Obtaining apigee-access

The `apigee-access` module is integrated into the Apigee Edge platform. When you
deploy Node.js code to Edge, this module is available to you. You simply need to require it in
any Node.js code that you deploy. For example:

```javascript
var access=require('apigee-access');
```

## Accessing flow variables

When you deploy a Node.js application to Edge, you can access any of the supported
"out-of-the-box" flow variables, flow variables created by policies, and any flow variables that
you create yourself from within your Node.js code. Flow variables are created and exist within
the context of an API proxy running on Edge. For detailed information, see
[Accessing flow variables in
Node.js](https://docs.apigee.com/api-platform/nodejs/access-flow-variables-nodejs).

## Accessing the cache

The `apigee-access` module lets you access the Apigee Edge distributed cache from
your Node.js code. For detailed information, see [Accessing the cache in Node.js](https://docs.apigee.com/api-platform/nodejs/access-cache-nodejs).

## Using the quota service

The `apigee-access` module lets you access the Apigee Edge quota service from your
Node.js code. For detailed information, see
[Accessing the quota service in
Node.js](https://docs.apigee.com/api-platform/nodejs/accessing-quota-service-nodejs).

## Accessing Key Value Maps

The `apigee-access` module lets you access Apigee Edge key value maps (KVMs) from
your Node.js code. For detailed information, see
[Accessing key value maps in
Node.js](https://docs.apigee.com/api-platform/nodejs/accessing-key-value-maps-nodejs).

## Running in local mode vs deployed mode

To support local development and testing, the `apigee-access` module
works in a [local mode](https://docs.apigee.com/api-platform/nodejs/using-apigee-access#LocalMode) with no dependencies on Apigee Edge; however,
when the module is used with an API proxy that is [deployed to
Edge](https://docs.apigee.com/api-platform/nodejs/using-apigee-access#DeployedMode), the "local" functionality is replaced by native Edge functionality. For example, the
full compliment of flow variables are accessible in deployed mode, while only a small subset are
available when you run the Node.js application locally. For a list of these local-mode variables,
see [Running in local mode](https://docs.apigee.com/api-platform/nodejs/using-apigee-access#LocalMode).

### Determining the mode in which the module is running

To determine which mode you are running apigee-access in:

```javascript
var access = require('apigee-access')
console.log('The deployment mode is ' + access.getMode());
```

The return value of getMode() tells you whether or not the Node.js application is deployed
to Apigee Edge or is running in standalone mode. The method returns one of these two string
results:

- `apigee` - The Node.js application is running on Apigee Edge and all functionality is supported.
- `standalone` - The Node.js application is running outside the Apigee Edge environment, and the default functionality described at the top of the document takes effect.

### Running in deployed mode

When deployed to Edge, variables set by policies are visible to `apigee-access`,
and variables added or modified by this module's methods are visible to subsequent policies in
the proxy flow.

You can find the link of supported variables in the
[Variables Reference](https://docs.apigee.com/api-platform/reference/variables-reference). These variables,
and any that you create with your own names, are visible to `apigee-access`. Note
that some variables are read-only. They are identified in the
[Variables Reference](https://docs.apigee.com/api-platform/reference/variables-reference).

### Running in local mode

In "local mode," you are running your Node.js code outside the context of Apigee Edge. In
this mode, most of the pre-defined flow variables are not accessible within your Node.js
code. This table shows the small subset of flow variables that are available. These variables
are supported here in order to support local development and testing of Node.js applications
for Apigee Edge.

|---|---|---|---|
| **Variable** | **Read-Only** | **Type** | **Notes** |
| `client.received.start.time` | Yes | String | Time at which the request was received |
| `client.received.end.time` | Yes | String | Time at which the request was received |
| `client.received.start.timestamp` | Yes | Integer | Time at which the request was received |
| `client.received.end.timestamp` | Yes | Integer | Time at which the request was received |

Again, on the Apigee Edge platform, a much larger set of pre-defined variables is supported.
Refer to the Apigee Edge [Variables
Reference](https://docs.apigee.com/api-platform/reference/variables-reference) for the complete list.

> [!NOTE]
> **Note:** Missing a variable that you need for a test? Open a [GitHub issue](https://github.com/apigee/apigee-access) and we can add it, or send a pull request.