Code Monkey home page Code Monkey logo

predix-nodejs-starter's Introduction

Predix Development Kit - NodeJs Starter Application

This is simple starter Node application that demonstrates user authentication with Predix UAA, and integration with microservices.

Running locally

Edit the config.json to run the application locally for your UAA client.

Sample :

"development":{
  "clientId": "${clientId}",
  "uaaUri" : "${UAA URL}",
  "base64ClientCredential": "${base 64 encoding of clientId:secret}",
  "appUrl": "http://localhost:3000",
  "assetZoneId": "${asset zone id for Asset service instantiated}",
  "tagname": "${tag name list to query. Separated by comma}",
  "assetURL": "${The asset url to query the tags from. https://<assetURI>/<assetType>}",
  "timeseries_zone": "${timeseries zone id for Timeseries service instantiated}",
  "timeseriesURL": "${Timeseries to query for data. <TimeseriesURI>/v1/datapoints}",
  "uaaURL": "${The UAA URI. <UaaURI>/predix.io",
}

Note: You can encode your clientId:secret combination using https://www.base64encode.org/ or the base64 command on Unix / Mac OSX.

echo -n clientId:clientSecret | base64

Install and start local web server

npm install
node app.js or npm start

Navigate to http://localhost:3000 in your web browser.

Debugging

DEBUG=predix-boot-node-app:* npm start
DEBUG=express:* npm start

Run sample tests

A sample unit test is included, which you can run with npm: npm test

Running locally behind a corporate firewall

If you are behind a corporate firewall, make sure you have the http_proxy environment variable set in the same terminal window where you start the server.

Running in the cloud

Set up the manifest file for Cloud deployment

  1. Copy manifest.yml.template to my-app-manifest.yml.
  2. Edit the my-app-manifest.yml
---
applications:
- name: <front end app name>
  memory: 128M
  buildpack: nodejs_buildpack
  #command:  DEBUG=express:* node app.js
  command:  node app.js
services:
- <asset instance service name>
- <timeseries instance service name>
- <uaa instance service name>
env:
    node_env: cloud
    uaa_service_label : predix-uaa
    clientId: <client id with timeseries and asset scope>
    base64ClientCredential: <base64 encoding of client id>
    # Following properties configured only for Timeseries WindData service Integration
    assetMachine: <The asset name pushed to Asset service>
    tagname: <The asset tag pushed to Asset service>

predix push <appName> -f my-app-manifest.yml

Analytics

predix-nodejs-starter's People

Contributors

abdelkrim avatar gstroup avatar johnyesberg avatar sankarnr avatar turnerth avatar

Watchers

 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.