Skip to content
Migrating openmrs-contrib-atlas from php Laravel Framework to Node.js app
JavaScript CSS HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
public
routes
views
.gitignore
README.md
app.js
db.js
package-lock.json
package.json

README.md

openmrs-contrib-atlas-node

OpenMRS Talk OpenMRS IRC OpenMRS Telegram devDependencies Status Dependencies Status

OpenMRS

OpenMRS Atlas 3.0

Description

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

Setting Up

Prerequisite

  • Install nodejs

  • Install nodemon globally(if you need it)

    npm install -g nodemon
    
  • Install the latest mysql

SetUp repo

  • Clone the repo

    $ git clone https://github.com/ShekharReddy4/openmrs-contrib-atlas-node.git
    $ cd openmrs-contrib-atlas-node
    
  • Install the dependencies

    npm install
    

Populate the DataBase

  • 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;
        

Configure the app as per your DB credentials and PORT

  • 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
    

SetUp the OpenMRS ID

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.

Run

  • 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 )

Note

  • 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)

Code Structure

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.

Contribute

  1. Fork the repo.

  2. Clone the fork to your machine.

  3. Make changes in required files, reload the browser to verify the changes.

  4. Squash the commits and Create a pull request.

External Links and Useful Resources

You can’t perform that action at this time.