You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@hmcts/cmc-draft-store-middleware

Package Overview
Dependencies
Maintainers
16
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hmcts/cmc-draft-store-middleware

Node.js middleware for draft store

2.0.1
latest
npm
Version published
Weekly downloads
11
-38.89%
Maintainers
16
Weekly downloads
 
Created
Source

@hmcts/cmc-draft-store-middleware

Travis badge Codecov badge NPM version badge Node version badge Greenkeeper badge Standard - JavaScript Style Guide

This is a Node.js/Express library for interacting with the draft store API. The middleware retrieves draft of selected type from the draft store API and sets it in Express.js local user scope. If draft does not exist in the draft store then an empty draft is set it in Express.js local user scope.

Getting started

How to use it?

Installation

To add library to the project dependencies run:

$ yarn add @hmcts/cmc-draft-store-middleware

or

$ npm install @hmcts/cmc-draft-store-middleware

Sample code

Example use of the middleware in the Express.js application is presented below:

import { DraftMiddleware } from '@hmcts/cmc-draft-store-middleware'

const draftService: DraftService = ... // initiate draft service prior using middleware
app.all(/^.*$/, DraftMiddleware.requestHandler(draftService, 'default', (value: any): any => value))

How to contribute?

Prerequisites

  • Node.js
  • yarn

Dependencies

Install dependencies by executing the following command:

$ yarn install

Code style

We use TSLint with StandardJS rules

Run the linting:

$ yarn lint

Linting will also run automatically prior to committing changes.

Running the tests

Mocha is used for writing tests.

Run them with:

$ yarn test

For test coverage run:

$ yarn test:coverage

License

This project is licensed under the MIT License - see the LICENSE file for details

FAQs

Package last updated on 12 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts