Giter VIP home page Giter VIP logo

2wp-api's Introduction

Quality Gate Status

2wp-api

This is the API component for 2-Way-Peg solution.

The solution will be a web interface, which integrates with a Rest API (this application), which in turn communicates with internal services such as the blockchain node and databases. In addition, a daemon/worker will be created that will be responsible for obtaining data from the blockchain and changing the status of the transaction.

Development Mode

The 2wp-api application will run on 3000 port.

Include a .env file with the required environment variables listed in .env.test file (you can copy that file).

Check npm and node versions

npm -version
6.14.16
node -v
v14.19.1

Install dependencies

npm install

To only install resolved dependencies in package-lock.json:

npm ci

Session DB

Move to the SessionDB folder and run:

docker-compose up -d

RSK DB

Move to the rsk-database folder, copy your .env file in it and then run:

docker-compose up -d

For some reason passing --env-file argument to docker-compose doesn't seem to be working fine. That's why we need to copy the .env file here too.

Environment Variables

To verify all environment variables, please click here for environment variables details.

Create user with admin permissions to connect without errors to mongoDB

To connect without authentication errors to mongodb, in root directory run:

$ docker exec -it 2wp-rsk-mongo-database bash
$ mongosh
$ use rsk
$ db.createUser(
    {
      user: "api-user",
      pwd: "pwd",
      roles: [
        { role: "userAdmin" , db:"rsk"  }
      ]
    }
  )

Using npm to run the application

If you want to start the API alongside the daemon run:

npm start

If you prefer to execute just the API run:

npm run start-api

Open http://127.0.0.1:3000 in your browser to discover the API capabilities

If you prefer to execute just the daemon run:

npm run start-daemon

Fix code style and formatting issues

npm run eslint

To automatically fix such issues:

npm run eslint:fix

Build & test project

npm ci
npm run unit-test
npm run eslint
npm run only-coverage

Deployment

In the root directory run:

docker-compose up

Other useful commands

  • npm run openapi-spec: Generate OpenAPI spec into a file

LoopBack

Report Security Vulnerabilities

To report a vulnerability, please use the vulnerability reporting guideline for details on how to do it.

2wp-api's People

Contributors

ronaldsg20 avatar josedahlquist avatar alexjavabraz avatar jeremy-then avatar pamgonzalez avatar lserra-iov avatar julia-zack avatar crove-iov avatar dependabot[bot] avatar ivaniov avatar leoiovlabs avatar annipi avatar mesirendon avatar bcodesido avatar lgtm-migrator avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.