Using Node.js Libraries


Declaring and managing dependencies

Dependencies for Node.js applications are declared in a standard package.json file. For example:

  "dependencies": {
    "lodash": "^4.0.1"

You can use any Linux-compatible Node.js package with App Engine flexible environment, including packages that require native (C) extensions.

During deployment, the Node.js runtime automatically installs all dependencies declared in your package.json file.

Installing a web framework

You'll need to use a web framework to enable your app to serve web requests. You can use any Node.js web framework including the following:

To use a particular web framework, just add it to your package.json file:

"dependencies": {
  "express": "^4.13.4"

Or let NPM update your package.json file for you:

$ npm install --save express

Installing the Google Cloud Client library

The Google Cloud Client Library for Node.js is a client library for accessing Google Cloud Platform services that significantly reduces the boilerplate code you have to write. The library provides high-level API abstractions so they're easier to understand. It embraces idioms of Node.js, works well with the Node.js core modules, and integrates better with your codebase. This means you spend more time creating code that matters to you.

To install the library locally:

$ npm install --save gcloud

The client library can automatically handle authentication for you locally as well by using the Google Cloud SDK:

$ gcloud auth login

Send feedback about...

App Engine flexible environment for Node.js docs