Skip to content

Instantly share code, notes, and snippets.

@mnjstwins
Forked from shabiel/ewd3_cache.md
Created December 9, 2016 18:36
Show Gist options
  • Save mnjstwins/236233a8fe630e8f6032003fd679025b to your computer and use it in GitHub Desktop.
Save mnjstwins/236233a8fe630e8f6032003fd679025b to your computer and use it in GitHub Desktop.
Getting Started with EWD 3

EWD 3 on Cache/Windows

Documentation in Public Domain. No copyright claimed.

I am doing this on Cache/Windows with MinGW.

Everytime I say "test", you need to do a full sanity test. It will be obvious when things don't work.

First need to install Cache and Node.js. Make sure your Cachexxxx.node version and your node.js version are the same.

EWD Xpress Install

Reference: https://groups.google.com/d/msg/enterprise-web-developer-community/Wth-hLoAOpI/j8XyXog-BAAJ

mkdir ewd3
cd ewd3
npm install ewd-xpress ewd-xpress-monitor
cp /c/InterSystems/Cache/bin/cache0120.node node_modules/cache.node
mv ~/ewd3/node_modules/ewd-xpress/example/ewd-xpress.js ~/ewd3/ewd-xpress.js

Edit config.database.params to connect to your Cache.

Test

node ewd-xpress.js

Install manager portal.

mkdir www && cd www
mkdir ewd-xpress-monitor
cp ~/ewd3/node_modules/ewd-xpress-monitor/www/bundle.js ~/ewd3/www/ewd-xpress-monitor
cp ~/ewd3/node_modules/ewd-xpress-monitor/www/*.html ~/ewd3/www/ewd-xpress-monitor
cp ~/ewd3/node_modules/ewd-xpress-monitor/www/*.css ~/ewd3/www/ewd-xpress-monitor
node ewd-xpress.js

Test: Navigate to http://127.0.0.1:8080/ewd-xpress-monitor/index.html. Password is 'keepThisSecret!'

Install EWD Client and Test App

Reference: https://groups.google.com/d/msg/enterprise-web-developer-community/f0IIf8xpiHs/NrRWdD5WBAAJ

npm install ewd-client
cp ~/ewd3/node_modules/ewd-client/lib/proto/ewd-client.js ~/ewd3/www
cp ~/ewd3/node_modules/ewd-xpress/example/test-app/index.html ~/ewd3/www/test-app.html # Error in Rob's docs: must have .html.
cp ~/ewd3/node_modules/ewd-xpress/example/test-app/node_modules/test-app.js ~/ewd3/node_modules

Test: http://localhost:8080/test-app.html. Check console for EWD register events.

Install React.js


cd ~/ewd3

npm install react react-dom babelify babel-preset-react react-bootstrap react-toastr react-select socket.io-client
npm install jquery ewd-client ewd-react-tools ewd-xpress-react

npm install -g browserify
npm install -g uglify-js

cd ~/ewd3/www/ewd-xpress-monitor
npm install babel-preset-es2015

# Now you can compile an application bundle:
#  cp ~/ewd3/node_modules/ewd-xpress-monitor/www/*.js ~/ewd3/www/ewd-xpress-monitor
#  cd ~/ewd3/www/ewd-xpress-monitor
#  or
#  cd ~/ewd3/node_modules/ewd-xpress-monitor/www
#  browserify -t [ babelify --compact false --presets [es2015 react] ] app.js | uglifyjs > bundle.js
#  cp ~/ewd3/node_modules/ewd-xpress-monitor/www/bundle.js ~/ewd3/www/ewd-xpress-monitor

React simple application

#!/usr/bin/env bash

# Pulls in a basic React.js / react-bootstrap demonstration application
#  from the ewd-xpress-react module,
#  for learning and understanding the design pattern recommended for use
#  with EWD 3 / ewd-xpress

# Create the run-time directory for the application's HTML, JS and CSS resources

cd ~/ewd3/www
mkdir example-socket-app

# Copy in the HTML and CSS resources from the ewd-xpress-react module

cp ~/ewd3/node_modules/ewd-xpress-react/example/reactjs/*.html ~/ewd3/www/example-socket-app
cp ~/ewd3/node_modules/ewd-xpress-react/example/reactjs/*.css ~/ewd3/www/example-socket-app
cp ~/ewd3/node_modules/ewd-xpress-react/example/reactjs/*.js ~/ewd3/www/example-socket-app

# Copy the back-end module to the node_modules directory

cp ~/ewd3/node_modules/ewd-xpress-react/example/reactjs/node_modules/example-socket-app.js ~/ewd3/node_modules

echo 'Done!'

# Now you can compile an application bundle for this app:
#  cd ~/ewd3/node_modules/ewd-xpress-react/example/reactjs
#  browserify -t [ babelify --compact false --presets [es2015 react] ] app.js | uglifyjs > bundle.js
#  cp ~/ewd3/node_modules/ewd-xpress-react/example/reactjs/bundle.js ~/ewd3/www/example-socket-app

# Run it using http://192.168.1.100:8080/example-socket-app/index.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment