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.
How to use it?
To add library to the project dependencies run:
$ yarn add @hmcts/cmc-draft-store-middleware
$ npm install @hmcts/cmc-draft-store-middleware
Example use of the middleware in the Express.js application is presented below:
app.all/^.*$/, DraftMiddleware.requestHandlerdraftService, 'default',value
How to contribute?
Install dependencies by executing the following command:
$ yarn install
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
This project is licensed under the MIT License - see the LICENSE file for details