Skip to content

terrabrasilis/file-delivery

Repository files navigation

file-delivery Build Status Dependency Status Coverage percentage standard forthebadge

NODE VERSION

You should user Node version >= 12

Installation

$ yarn install

Usage

then start the server

$ yarn start

Unit tests

$ yarn test

Getting the coverage report:

$ yarn coverage

API Usage:

Download the file based on a public or admin access

Gets the file based on the Json Web Token that are sent in the requisition.

URL : /download/:projectId/:frequency

Path Params :

projectId: `['deter-cerrado', 'deter-amz']`	
frequency: `['monthly', 'daily']`

Method : GET

Auth required : NO

Permissions required : None

Success Responses

Condition : User gets the public file.

Code : 200 OK

Content : {type: public}

{
    "type": "public"
}

OR

Condition : User gets the admin file.

Code : 200 OK

Content : {type: admin}

{
    "type": "admin"
}

Deploy Info

Build and Run your image

From your Node.js app project folder launch those commands:

$ docker build -t file-delivery .
$ docker run -p 9000:9000 file-delivery

Pushing to Docker Hub:

$ docker build -t file-delivery .
$ docker images # look and find the hash you want
$ docker tag local-image:tagname reponame:tagname
$ docker push reponame:tagname
# EXAMPLE:
$ docker tag bfe06c2b5dea terrabrasilis/file-delivery:v1.0.0
$ docker push terrabrasilis/file-delivery

Useful commands

Command Description
$ docker exec -it <container-id> pm2 monit Monitoring CPU/Usage of each process
$ docker exec -it <container-id> pm2 list Listing managed processes
$ docker exec -it <container-id> pm2 show Get more information about a process
$ docker exec -it <container-id> pm2 reload all 0sec downtime reload all applications
$ docker exec -it <container-id> pm2 logs --format see all applications logs
$ docker exec -it <container-id> pm2 flush flush applications logs

License

MIT © Paulo Luan