Skip to main content

Herbs Shelf

Herbs Shelf is a self-generated documentation based on use cases and entities from your domain.

Herbs Shelf make it possible to collaborate between domain experts and developers without having to read any code.

Glues

Installing

$ npm install @herbsjs/herbsshelf

Using

To use Herbs Shelf, all you have to do is to inform a list of use cases and it will return a string containing the HTML with the generated documentation.

The quickest way to use Herbs Shelf is to create a rest route in your api and expose the documentation generated by the shelf.

Consider a file called _uclist.js with this inside

module.exports = (injection) => {
return [
{ usecase: require('./myUseCaseFile').myUseCaseName(injection), tags: { group: 'GroupOne' } },
{ usecase: require('./myUseCase2File').myUseCase2Name(injection), tags: { group: 'GroupOne' } },
{ usecase: require('./myUseCase3File').myUseCase3Name(injection), tags: { group: 'GroupTwo' } },
]
}

In your app or server file, import the shelf dependecy and the list of use cases

const usecases = require('../../domain/usecases/_uclist')
const renderShelfHTML = require('@herbsjs/herbsshelf')

And call the shelf into you prefered rest route

 this.app.get('/herbsshelf', (req, res, next) => {
res.setHeader('Content-Type', 'text/html')
const shelf = renderShelfHTML(usecases())
res.write(shelf)
res.end()
})

Example

You can see Herbs Shelf in action in the To Do List On Herbs project.