The ECN-Viewer should be used as a node package with an Express server. The ECN-Viewer package exposes a function that takes Express as an argument and returns a middleware that will serve the application.
npm i @iofog/ecn-viewer
const ecnViewer = require('@iofog/ecn-viewer')
const express = require('express')
...
app.use('/', ecnViewer.middleware(express))
This set up will get you going with an Express server that will proxy your requests to the configured ECN Controller, this is currently a work around CORS issues and is only suited for development purposes.
./bootstrap.sh
will install Node.js and NPM using Node Version Manager (nvm)
Note: NVM being a sourced script, a few extra commands are needed in order to be able to use nvm in your current shell session
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
npm run start-dev
The script will use the config ./controller_dev.json
, to bundle the web application. The web application will use the controller information from the config file as its ECN Controller. (This can later on be modified through the web app, using the settings icon on the lateral nav bar.)
The web server will listen on the PORT env variable (or 80 by default).
The configuration JSON file contains the informations required to connect to your ECN Controller.
{
"ip": "127.0.0.1",
"port": "51121",
"dev": true,
"refresh": 3000,
"user": {
"email": "user@domain.com",
"password": "#Bugs4Fun"
}
}