Giter Site home page Giter Site logo

catalinmiron / nodejs-docs-samples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecloudplatform/nodejs-docs-samples

0.0 3.0 0.0 3.79 MB

Node.js samples for Google Cloud Platform products.

Home Page: https://cloud.google.com/nodejs

License: Apache License 2.0

JavaScript 88.37% HTML 11.15% CSS 0.47%

nodejs-docs-samples's Introduction

Google Cloud Platform logo

Google Cloud Platform Node.js Samples Slack Build Coverage

Node.js samples for Google Cloud Platform products.

See cloud.google.com/nodejs to get up and running with Node.js on Google Cloud Platform.

Table of Contents

Setup

Prerequisites

  1. Install Node.js (and NPM)

  2. Clone this repository:

     git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git
    
  3. Change directory in to the project:

     cd nodejs-docs-samples
    
  4. Set the GCLOUD_PROJECT environment variable:

    Linux:

     export GCLOUD_PROJECT=your-project-id
    

    Windows:

     set GCLOUD_PROJECT=your-project-id
    

    Windows (PowerShell):

     $env:GCLOUD_PROJECT="your-project-id"
    
  5. Obtain authentication credentials.

    Create local credentials by running the following command and following the oauth2 flow (read more about the command here):

     gcloud beta auth application-default login
    

    In non-Google Cloud environments, GCE instances created without the correct scopes, or local workstations where the gcloud beta auth application-default login command fails, use a service account by doing the following:

    • Go to API Manager -> Credentials
    • Click "New Credentials", and create a service account or click here
    • Download the JSON for this service account, and set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to the file containing the JSON credentials.

    Set the GOOGLE_APPLICATION_CREDENTIALS environment variable:

    Linux:

     export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account_file.json
    

    Windows:

     set GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account_file.json
    

    Windows (PowerShell):

     $env:GOOGLE_APPLICATION_CREDENTIALS="/path/to/service_account_file.json"
    

    Note for code running on GCE, GAE, or other environments:

    On Google App Engine, the credentials should be found automatically.

    On Google Compute Engine, the credentials should be found automatically, but require that you create the instance with the correct scopes.

     gcloud compute instances create --scopes="https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/compute,https://www.googleapis.com/auth/compute.readonly" test-instance
    

    If you did not create the instance with the right scopes, you can still upload a JSON service account and set GOOGLE_APPLICATION_CREDENTIALS as described.

    Read more about Google Cloud Platform Authentication.

How to run a sample

  1. Change directory to one of the sample folders, e.g. bigquery:

     cd bigquery/
    
  2. Install the sample's dependencies (see the sample's README for details):

     npm install
    
  3. Run the sample:

     node sample_file.js [args]...
    

How to run the tests

  1. Read the Contributing Guide.

  2. Set the TEST_BUCKET_NAME environment variable to the name of a test Google Cloud Storage bucket:

    Linux:

     export TEST_BUCKET_NAME=your-bucket-name
    

    Windows:

     set TEST_BUCKET_NAME=your-bucket-name
    

    Windows (PowerShell):

     $env:TEST_BUCKET_NAME="your-bucket-name"
    
  3. In a terminal, start Redis:

     redis-server
    
  4. In another terminal, start memcached:

     memcached
    
  5. In another terminal, run the tests from the root of the project:

     npm test
    

Client libraries

Google Cloud Platform logoGoogle Cloud Node.js client library

The idiomatic client for Google Cloud Platform services.

Google logoGoogle API Node.js client library

Node.js client library for Google APIs.

Code samples

Google App Engine (flexible environment)

The App Engine flexible environment is based on Google Compute Engine and automatically scales your app up and down while balancing the load.

View the App Engine flexible environment Node.js samples.

Google BigQuery

BigQuery is Google's fully managed, petabyte scale, low cost analytics data warehouse.

View the BigQuery Node.js samples.

Google Compute Engine

Compute Engine lets you create and run virtual machines on Google infrastructure.

View the Compute Engine Node.js samples.

Google Container Engine

Container Engine: Run Docker containers on Google Cloud Platform, powered by Kubernetes.

View the Container Engine Node.js samples.

Google Cloud Datastore (Beta)

Cloud Datastore is a NoSQL document database built for automatic scaling, high performance, and ease of application development.

View the Cloud Datastore Node.js samples.

Stackdriver Debugger (Beta)

Stackdriver Debugger makes it easier to view the application state without adding logging statements.

View the Stackdriver Debugger Node.js sample.

Google Cloud Functions (Alpha)

Sign up for the Alpha.

Cloud Functions is a lightweight, event-based, asynchronous compute solution that allows you to create small, single-purpose functions that respond to Cloud events without the need to manage a server or a runtime environment.

View the Cloud Functions Node.js samples.

Stackdriver Logging (Beta)

Stackdriver Logging allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services.

View the Stackdriver Logging Node.js samples.

Stackdriver Monitoring (Beta)

Stackdriver Monitoring collects metrics, events, and metadata from Google Cloud Platform, Amazon Web Services (AWS), hosted uptime probes, application instrumentation, and a variety of common application components including Cassandra, Nginx, Apache Web Server, Elasticsearch and many others.

View the Stackdriver Monitoring Node.js samples.

Google Cloud Prediction API

The Cloud Prediction API provides a RESTful API to build Machine Learning models.

View the Cloud Prediction API Node.js samples.

Google Cloud Pub/Sub

Cloud Pub/Sub is a fully-managed real-time messaging service that allows you to send and receive messages between independent applications.

View the Cloud Pub/Sub Node.js samples.

Google Cloud Speech API (Alpha)

Sign up for the Alpha.

The Cloud Speech API enables easy integration of Google speech recognition technologies into developer applications.

View the Cloud Speech API Node.js samples.

Google Cloud Storage

Cloud Storage allows world-wide storage and retrieval of any amount of data at any time.

View the Cloud Storage Node.js samples.

Stackdriver Trace (Beta)

Stackdriver Trace is a distributed tracing system for Google Cloud Platform that collects latency data from App Engine applications and displays it in near real time in the Google Cloud Platform Console.

View the Stackdriver Trace Node.js sample.

Google Cloud Vision API

The Cloud Vision API allows developers to easily integrate vision detection features within applications, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content.

View the Cloud Vision API Node.js samples.

Other sample applications

Bookshelf tutorial app

The Bookshelf app is a sample web app written in Node.js that shows you how to use a variety of Google Cloud Platform features.

View the tutorial or the source code.

LabelCat

LabelCat is a NodeJS app that uses the Google Cloud Prediction API to automatically label GitHub Issues as they are created.

View the tutorial or the source code.

Node.js Codelab

In the Node.js Web App Google Cloud Platform codelab, you learn how to integrate Google Cloud Platform services into a Node.js web application to store data, upload images, and authenticate users.

View the tutorial or the source code.

Contributing

Contributions welcome! See the Contributing Guide.

License

Apache Version 2.0

See LICENSE

nodejs-docs-samples's People

Contributors

amygdala avatar broady avatar danholevoet avatar dhermes avatar elibixby avatar fredsa avatar ggowan avatar jasonpolites avatar jeffmendoza avatar jerjou avatar jmdobry avatar jsimonweb avatar jterrace avatar justinbeckwith avatar lesv avatar mco-gh avatar oalami avatar pcostell avatar sankalpk avatar thesandlord avatar tmatsuo avatar walterhub avatar waprin avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.