Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.01 KB

README.md

File metadata and controls

48 lines (36 loc) · 1.01 KB

herbs2repl

Herbs REPL

Herbs REPL

Installing

    $ npm install @herbsjs/herbs2repl

Using

src/domain/usecases/_uclist.js:

module.exports = (injection) => {
    return [
        { usecase: require('./createItem').createItem(injection), tags: { group: 'Items' } },
        { usecase: require('./updateItem').updateItem(injection), tags: { group: 'Items' } },
        ...
     ]
}

src/infra/repl/index.js:

const usecases = require('../../domain/usecases/_uclist')
const repl = require('@herbsjs/herbs2repl')

const main = async (injection) => {

    // list of all use cases, initialized
    const ucs = usecases(injection)

    // your user for the REPL session
    const user = {
        canAddItem: true, canCreateList: true, canDeteleList: false,
        canGetLists: true, canUpdateItem: true, canUpdateList: true
    }

    repl(ucs, user, {groupBy: "group"})
}

main().then()

Then run on your terminal:

 $ node ./src/infra/repl