Week#: 13 Documentation

Hello, Time is flying and I feel indebted for this organization for providing such a great opportunity and I would like to thank my mentors Jan and Pascal for the guidance and whole community members for the support. I will work for this org post-GSoC and release the Atlas 3.0 soonish.

By the way, I am leading the scrum meets these days you can check them here.

This week I have documented what I have done till now: More on documentation

The Project 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.

What does each directory contain? :

  • package.json
    This file consists all the details of the dependencies, dev-dependencies, semantic version, etc.. which shows the state of the application.
  • app.js
           This file is the start of the application where an express app holds and uses all the middleware. The middleware that we use is here.
  • bin/www.js 
           Contains all script which creates the HTTP server on a mentioned PORT and starts the server once we start the server.
  • views/
           This directory contains all the template files which are generally the front-end part which uses the JS, CSS, Images and all resources from the public/ directory.
    1. index.ejs
        This project uses .ejs template engine for the views. The index.ejs file will render the google map API and the javascript from the public directory.
    2. error.ejs
        This file is a standard error file which can be rendered whenever an error is thrown so as the user knows what type of the error is that.
  • public/
          This directory consists of all the resources like JS, CSS, Images etc..
    1. CSS/
        contains all the CSS files which are used in the template engine.
    2. js/
        contains all the javascript files which are used in the views.
    3. images/
        contains all the images.
  • routes/
          routes dir contains all the route files each denoting a resource wherein the endpoints are defined. The resources that we have.
    1. distributions.js
        This file consists the defined endpoints for the distributions like one can create,update and delete the distributions.
    2. authentications.js
         This file consists the defined endpoints for the authentication.SSO decoding and logging the user –all that is related to auth resides here.
    3. markersites.js
          This file consists the defined CRUD operations for the markersites.

Authentication

I have written a library for authentication which can be used by anyone who wants to authenticate their app against OpenMRSID. This library can encode and decode a multipass token so that we could access the user details in the app and log the user.

In Atlas, we decode the token and put the user details in a session and use the session wherever we need the authentication. For detailed view of the code: Link

Functionalities

Atlas 3.0 doesn’t alter any functionalities that were in the older version of Atlas.

Resources

External Links

Github Repo

Thanks for reading 🙂

Regards

Shekhar 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s