1.0.0 • Published 5 years ago

loop-client-accounting-reports v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Accounting Reports client for the LOOP

This is the client for handle all the communication between Accounting Reports to the LOOP.

In synthesis, each client should follow this logic:

image

Development setup

This client's stack is fairly simple and straight forward, this instructions are assuming you're using OSX, although the setup should be fairly similar in any other POSIX OS.

Dependencies

If you don't have Node.js and NPM in your system, make sure you install it first. We can't go anywhere without them. We recommend nvm for that.

Using Brew:

  brew install nvm
  nvm install v6.2.2

From source (using Bash):

  curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
  bash exec #Reload the bash shell here before you can use nvm
  nvm install v6.2.2

If using the Fish shell, there are a couple extra steps. Since nvm's source installation process doesn't support Fish, we'll add the bass wrapper.

First, execute the above source installation instructions inside a bash shell (not Fish). Then, install the Fisherman plugin manager:

  curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs git.io/fisher

Install the Bass (bash wrapper) plugin for Fish:

  fisher edc/bass

Add a Fish function for nvm using funced nvm, and add to it the following contents:

function nvm
   bass source ~/.nvm/nvm.sh --no-use ';' nvm $argv
end

At this point, you should have a functioning nvm executable which you can test with e.g. nvm list.

But, if you already have node and npm you will just need this tools if you want to generate changelogs.

$npm install -g conventional-changelog-cli

After that, you're good to go and install the application's dependencies:

$ npm install

Environment variables

Create a .env file and add the following variables with the values found in CloudAMQP or provided by the DevOps:

    LOOP_URL=""
    LOOP_PASS=""
    LOOP_USER=""

For security, this file will be ignored by git, do not force adding it.

Get up and running

This client runs, as a RESTful endpoint and a subscriber to the loop.

You can run both processes just by running:

$ npm start

Testing

$ npm test

Versioning

For consistancy in deployment automation we are going to version the loop clients. When a change is made in a new branch, the package.json file needs to be updated to reflect the severity level of the changes following the sematic versioning format defined at http://semver.org/ of Major, Minor and Patch. This would be reflected as v1.0.0 in the package.json file.

Once the feature branch has been merged and pushed to master, a get tag must be created in the master branch and pushed to the origin branch. A lightweight git tag is created by typing git tag v1.0.0 and should reflect the version in the package.json file. Once created, simply type git push origin v1.0.0 and the tag will appear as a release in the origin branch.

#Technology stack

  • Node.js
  • amqplib
  • body-parser
  • express
  • request
  • Docker