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

strongloop / express / 2528 / 6
99%
master: 100%

Build:
Build:
LAST BUILD BRANCH: 4.x
DEFAULT BRANCH: master
Ran 18 Nov 2015 11:52PM UTC
Files 43
Run time 1min
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

18 Nov 2015 11:44PM UTC coverage: 99.452%. First build
2528.6

push

travis-ci

defunctzombie
router: add async route handler support

While the async/await feature is still highly experimental and not
official, it does have preliminary support in tools like babel. There
are even blog posts [1] about how to use the async/await feature with
express routes.

However, these posts along with issue #2789 and #2788 show that using
async/await is still a bit of a manual process and not clear. This
change inspects the return value of a route handler to see if it is
potentially a pomise. If the return value appears to be a promise then
we attach to the error handler of the promise via .catch()

Now a user who is using babel can write the following without needing
any wrap functions as most examples to date require.

```js
app.get('/', async (req, res, next) => {
    let user = await User.findById(); // assuming .findById() returns a primise
    let org = await Org.findById();
    res.json({
        user: user,
        org: org,
    });
});
```

[1] https://strongloop.com/strongblog/async-error-handling-expressjs-es7-promises-generators/

1814 of 1824 relevant lines covered (99.45%)

397.87 hits per line

Source Files on job 2528.6
  • Tree
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 2528
  • Travis Job 2528.6
  • 07745487 on github
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

© 2025 Coveralls, Inc