The OpenHIM core component is responsible for providing a single entry-point into an HIE as well as providing the following key features:
- Point of service client authentication and authorization
- Persistence and audit logging of all messages that flow through the OpenHIM
- Routing of messages to the correct service provider (be it an HIM orchestrator for further orchestration or the actual intended service provider)
- Install Node.js 0.11.9 or greater
- Clone the
https://github.com/jembi/openhim-core-js.git
repository or download the code to the desired location - Install and start MongoDB
- Install the dependencies by running
npm install
- Start the server by running
node --harmony lib/server.js
Clone the https://github.com/jembi/openhim-core-js.git
repository or download the code.
- Node.js 0.11.9 or greater
- Koa framework
- MongoDB
The OpenHIM core makes use of the Koa framework, which requires node version 0.11.9 or greater. Node also has to be run with the --harmony
flag for this allocation to work.
The easiest way to use the latest version of node is to install nvm
. On Ubuntu, you can install using the install script but you have to add [[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh # This loads NVM
to the end of your ~/.bashrc
file as well.
Once nvm
is installed, run the following:
nvm install 0.11
nvm alias default 0.11
The latest version of node 0.11 should now be installed and set as default. The next step is to get all the required dependencies using npm
. Navigate to the directory where the openhim-core-js source is located and run the following:
npm install
In order to run the OpenHIM core server, MongoDB must be installed and running.
Skip this section if you have already installed MongoDB
- Linux install instructions:
- in Ubuntu run
sudo apt-get install mongodb
- in Ubuntu run
- OSX install instructions:
- using Homebrew, run
brew update
followed bybrew install mongodb
- using Homebrew, run
- To install MongoDB on Windows, follow the Windows install instructions.
For further information see the MongoDB installation documentation.
- Starting MongoDB on Linux:
- in Ubuntu run
sudo service mongodb start
- in Ubuntu run
- Starting MongoDB on OSX
- run
mongod
(ormongod --dbpath <some alternate directory>
to manually specify your data directory)
- run
- To run MongoDB on Windows, see the Windows documentation.
For more information see the MongoDB getting started guide.
This step is optional but recommended to ensure that the system is running as expected. To run the tests see the Testing section below.
Once all the prerequisites have been installed, configured and started, run the OpenHIM core server by executing the following:
node --harmony lib/server.js
The server will by default start in development mode using the mongodb database 'openhim-development'. To start the serve in production mode use the following:
NODE_ENV=production node --harmony lib/server.js
This starts the server with production defaults, including the use of the production mongodb database called 'openhim'.
This project uses mocha as a unit testing framework with should.js for assertions and sinon.js for spies and mocks. The tests can be run using either npm
or cake
.
To run the tests using npm
execute npm test
.
The project is build and tested using cake
, if you want to run cake directly, you will need CoffeeScript. Install CoffeeScript by executing the following:
npm install -g coffee-script
(omit the -g
if you don't wish to install globally)
See the CoffeScript website for more further information.
You can have the CoffeeScript files in src/
auto compile as you save them by running:
cake watch
To see some design docs refer to the OpenHIE wiki pages: