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
-
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.
-
Clone the repo
$ git clone https://github.com/openmrs/openmrs-contrib-atlas.git $ cd openmrs-contrib-atlas-node
-
Install the dependencies
npm install
-
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='<mysql username>' export DB_PASSWORD='<mysql password>' 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
-
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
- Fire up your browser to check http://localhost:3000
To stop:
ctrl+c
# docker-compose down -v
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.