OpenMRS-contrib-atlas-node is the server code written in nodejs for OpenMRS ATLAS. This project includes migrating the server side code from PHP Laravel framework to Nodejs, Making the Backend RESTful and authenticating the app against OpenMRS ID
-
Install nodejs
-
Install nodemon globally(if you need it)
npm install -g nodemon
-
Install the latest mysql
-
Clone the repo
$ git clone https://github.com/ShekharReddy4/openmrs-contrib-atlas-node.git $ cd openmrs-contrib-atlas-node
-
Install the dependencies
npm install
-
Create a database
mysql> CREATE DATABASE atlas;
-
Switch to the 'atlas' database
mysql> USE atlas;
-
Clone the sql script file
$ git clone https://gist.github.com/f15353ca4bdbb0677b049d4ab1555cdf.git $ cd f15353ca4bdbb0677b049d4ab1555cdf
copy the path of the atlas.sql file.
-
Run the sql script file (Note: there are multiple ways to run sql script file )
-
WINDOWS OS
mysql> SOURCE : path_to_the_atlas.sql
-
UBUNTU OS
-
Navigate to the directory where in sql file exists, in terminal
$ mysql -u uname -p dbname < atlas.sql;
-
-
-
change the credentials in db.js
set the variables to your credentials host : 'localhost', user : 'root', password : 'root', database : 'atlas'
-
change the port(if needed)
The following changes to be made here
var port = normalizePort(process.env.PORT || '3001'); //change the port number
I have written a mockID whose mechanism is similar to the OpenMRS ID. Follow the instructions in the README of atlas-mockid-node to get the setup of mockID locally.
-
Navigate to the project root directory and run the nodemon
$ nodemon
-
Fire up your browser to check http://localhost:3001 (URL may change as per your config above )
-
Always pull the latest changes.
$ git pull upstream master
-
Make sure that the ports hosting openmrs-contrib-atlas-node server and atlas-mockid-node server are unoccupied(I recommend not to change any port number, in case if they are occupied by any external server please stop them)
public/ | This directory contains js,css,images and lib files |
routes/ | Contains all the routes |
views/ | Contains all the front end code |
bin/www.js | Contains the script for creating and running the http server |
app.js | Creates an express app and holds all the middleware e.g auth middleware |
package.json | Manifest file used to manage project dependencies. |
-
Fork the repo.
-
Clone the fork to your machine.
-
Make changes in required files, reload the browser to verify the changes.
-
Squash the commits and Create a pull request.