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

strongloop / express / 2528
99%
master: 100%

Build:
Build:
LAST BUILD BRANCH: 4.x
DEFAULT BRANCH: master
Ran 18 Nov 2015 11:51PM UTC
Jobs 6
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

pending completion
2528

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/

6 of 6 new or added lines in 1 file covered. (100.0%)

1814 of 1824 relevant lines covered (99.45%)

2385.49 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
100.0
lib/router/layer.js
Jobs
ID Job ID Ran Files Coverage
1 2528.1 18 Nov 2015 11:51PM UTC 0
99.45
Travis Job 2528.1
2 2528.2 18 Nov 2015 11:51PM UTC 0
99.45
Travis Job 2528.2
3 2528.3 18 Nov 2015 11:51PM UTC 0
99.45
Travis Job 2528.3
4 2528.4 18 Nov 2015 11:51PM UTC 0
99.45
Travis Job 2528.4
5 2528.5 18 Nov 2015 11:51PM UTC 0
99.45
Travis Job 2528.5
6 2528.6 18 Nov 2015 11:52PM UTC 0
99.45
Travis Job 2528.6
Source Files on build 2528
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #2528
  • 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