I am working with the AMI library, available on github : https://github.com/FNNDSC/ami .
My development is under the commit f8d659d9b5768d3c82932c7be32fed2c67120b7d done the 24th of may 2018. Previously 63c8ff5d5932b1132bc08ac7f63776fa54c0c938 done the 14th of may 2018.
After cloning the git, dependencies are listed in the package.json . To install what is needed, run :
npm install
In order to simplify the server code we get rid of everything running AMI examples and AMI compilation.
The easiest way to do that is create a new server. In theory our application can be run from any server, we choose a Node.js server (for 'require', 'let', or ES6 syntax).
mkdir myApplicationName
cd myApplicationName
npm init
npm install express --save
To avoid writing a super long js file, we use the Module behavior with Webpack :
touch webpack.config.js
cd public && touch index.html bundle.js
cd .. && cd src && touch index.js && cd ..
mkdir assets && cd assets && mkdir fonts icons images stylesheets
(general setup, now webpack :)
npm install webpack --save
node_modules
are functional files/folderspackage.json
is the first configuration of the server : dependencies and available commands (in the section "script")index.js
is the entry point, contains the configuration of the server (host, port...)webpack.config.js
is the configuration of the 'compilation' of our jssrc
are readable .js before being bundled up. See the README.md file inside this folder for more information.public
is what we send to the user : html files and the bundle of our .js'
Documentation has not been pushed on this repository. To build it, run the following command :
yarn doc
A folder out is created. It contains the documentation.
This server has 2 main purposes
It will stay active and watch for modifications. It can be used to work while we edit files that don't need server to be seen.
Here we can open public/viewer.html without the server and use webpack to update the bundle.js with the final script :
yarn webpack
Use this when you don't work on dev and want to use the server and don't change the sources.
yarn start
Do both, the server is started and watch for modifications
yarn webpack_server