Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sckv committed Feb 7, 2022
1 parent 82fd455 commit 792fb3d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions README.md
Expand Up @@ -60,15 +60,15 @@ await TypedBus.publish({ amount: 1234, currency: 'EUR' });
## Wait for a hook resolution

```ts
import { TypedBus, Consume } from 'typed-bus';
import { TypedBus } from 'typed-bus';
import * as iots from 'io-ts';

class ExpressController {
@Post()
async addMoreMoney(req: Request, res: Response) {
console.log('I just received http request to add more money with body', req.body);

// this will wait 10 second for the event resolution
// this will wait 10 seconds for the event resolution
const data = await TypedBus.publish(req.body, {
hook: iots.type({ outcome: iots.literal('MONEY_ADDED'), account: iots.string }),
});
Expand All @@ -78,9 +78,7 @@ class ExpressController {
}

// somewhere instantiate the class with correct dependencies
new ConsumerTest();

// somewhere in the app call
new ExpressController();
```

## Define your transport
Expand Down

0 comments on commit 792fb3d

Please sign in to comment.