• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

metalabdesign / http-middleware-metalab / 193 / 2
96%
master: 97%

Build:
Build:
LAST BUILD BRANCH: midori
DEFAULT BRANCH: master
Ran 01 Feb 2016 07:48PM UTC
Files 26
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

01 Feb 2016 06:40PM UTC coverage: 95.856%. First build
193.2

push

travis-ci

izaakschroeder
Add `thunk` middleware.

Sometimes you want to change the processing mechanism of your application at runtime instead of construction time. For example:

```javascript
const app = compose(
  match(path('/foo'), send())
);
```

This app structure is static; what if we wanted routes from a database? Such a thing is now possible in relatively elegant fashion:

```javascript
const app = compose(
  thunk((app) => {
    let result = app;
    db.on('update', (routes) => {
      result = routes.reduce((result, route) => {
        return middlewareForRoute(route)(result);
      }, app);
    });
    return () => result;
  })
);
```

The `thunk` middleware basically defers access to the appropriate method (e.g. `request`, `error`, etc.) to the last possible moment at which point it calls the thunk to get the method at that instant.

347 of 362 relevant lines covered (95.86%)

3.66 hits per line

Source Files on job 193.2
  • Tree
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 193
  • Travis Job 193.2
  • 98afe75a on github
  • Next Job for on thunk (#195.3)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc