Skip to content
OpenMRS Atlas Server
JavaScript HTML TSQL CSS Other
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
db
docker
public
routes
views
.dockerignore
.gitignore
Dockerfile
README.md
app.js
conf.example.js
db.js
docker-compose.yml
ldap.js
package-lock.json
package.json
utils.js

README.md

openmrs-contrib-atlas-node

OpenMRS IRC OpenMRS Telegram

OpenMRS

OpenMRS Atlas 3

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
    
  • Get a Google Maps JS API key from the Google API console. Make sure to enable JS google maps and static google maps API in your project/account.

SetUp repo

  • Clone the repo

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

    npm install
    

Running

Running Locally

  • Install MySQL

  • Create a database

    mysql> CREATE DATABASE atlasdb;
  • Switch to the 'atlasdb' database

    mysql> USE atlasdb;
  • Run the sql script files (Note: there are multiple ways to run sql script files )

    • WINDOWS OS

      mysql> SOURCE : db/01_database.sql
      mysql> SOURCE : db/02_updates.sql
      mysql> SOURCE : db/03_demo_data.sql
      
    • UBUNTU OS

      • Navigate to the directory where the sql files exist, in terminal

          $ mysql -u uname -p dbname < db/01_database.sql;
          $ mysql -u uname -p dbname < db/02_updates.sql;
          $ mysql -u uname -p dbname < db/03_demo_data.sql;
        
        
  • create environment variables in your bash

      export DB_HOST='localhost'
      export DB_USERNAME='root'
      export DB_PASSWORD='root'
      export DB_NAME='atlasdb'
      export GOOGLE_MAPS_JS_API_KEY='<your google api key>'
      ```
  • Navigate to the project root directory and run the nodemon

    $ nodemon
    
  • Fire up your browser to check http://localhost:3000

Running using docker

  • Install docker and docker-compose

  • Clone and start ldap-stg following instructions in repository

  • Build and start atlas inside a docker container

export GOOGLE_MAPS_JS_API_KEY='<your google api key>'
$ docker-compose build
$ docker-compose up -d

To stop:

ctrl+c
# docker-compose down -v

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.

You can’t perform that action at this time.