Skip to content

DalderupMaurice/express-hlf-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express boilerplate with the Hyperledger SDK

This creates a project boilerplate for Express boilerplate with the Hyperledger SDK

Build Status Coverage Status Dependency Status DeepScan grade

Overview

This is a boilerplate application for building REST APIs in Node.js using ES6 and Express with Code Coverage and JWT Authentication. It also includes the HLF SDK. Helps you stay productive by following best practices. Follows Airbnb's Javascript style guide.

Getting Started

Clone the repo:

git clone https://github.com/DalderupMaurice/express-hlf-example.git
cd express-hlf-example

Install yarn:

npm install -g yarn

Install dependencies:

yarn

Set environment (vars):

cp .env.example .env

Start server:

# Start server
yarn start

# Selectively set DEBUG env var to get logs
DEBUG=express-hlf-example:* yarn start

Tests:

# Run tests written in ES6
yarn test

# Run test along with code coverage
yarn test:coverage

# Run tests on file change
yarn test:watch

# Run tests enforcing code coverage (configured via .istanbul.yml)
yarn test:check-coverage

Lint:

# Lint code with ESLint
yarn lint

# Run lint on any file change
yarn lint:watch

Other gulp tasks:

# Wipe out dist and coverage directory
gulp clean

# Default task: Wipes out dist and coverage directory. Compiles using babel.
gulp
Deployment
# compile to ES5
1. yarn build

# upload dist/ to your server
2. scp -rp dist/ user@dest:/path

# install production dependencies only
3. yarn --production

# Use any process manager to start your services
4. pm2 start dist/index.js

In production you need to make sure your server is always up so you should ideally use any of the process manager recommended here. We recommend pm2 as it has several useful features like it can be configured to auto-start your services if system is rebooted.

Contributing

Contributions, questions and comments are all welcome and encouraged. For code contributions submit a pull request with unit test.

License

This project is licensed under the MIT License

Meta

Maurice Dalderup – @mauricedalderupMaurice_Dalderup@hotmail.com

About

An example implementation of express and the fabric SDK, interacting with chaincode

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •