Commit 9836e9e9dcd5acec7ee3725da3b5e9784a5490bd
express routes in a style where adding a route only changes
a single line. This makes merges much less likely to conflict. @mixmix previously, using destructuring `const {...} = api.app.pages` means that line is changed by every merge, so two branches adding routes cannot be merged without a conflict.Dominic Tarr committed on 8/9/2017, 9:00:14 PM
Parent: dca0c3f17aa539ddd99053c9d36d42c371bc44b4
Files changed
router/sync/routes.js | changed |
router/sync/routes.js | ||
---|---|---|
@@ -10,15 +10,15 @@ | ||
10 | 10 | }) |
11 | 11 | |
12 | 12 | exports.create = (api) => { |
13 | 13 | return nest('router.sync.routes', (sofar = []) => { |
14 | - const { home, group, channel, private: privatePage } = api.app.page | |
15 | - | |
14 | + const pages = api.app.page | |
16 | 15 | // route format: [ routeValidator, routeFunction ] |
17 | 16 | const routes = [ |
18 | - [ location => location.page === 'home', home ], | |
19 | - [ location => location.type === 'group', group ], | |
20 | - [ location => !isEmpty(location.key), privatePage ] | |
17 | + [ location => location.page === 'home', pages.home ], | |
18 | + [ location => location.type === 'group', pages.group ], | |
19 | + [ location => location.page === 'channel', pages.channel ], | |
20 | + [ location => !isEmpty(location.key), pages.privatePage ] | |
21 | 21 | ] |
22 | 22 | |
23 | 23 | return [...routes, ...sofar] |
24 | 24 | }) |
@@ -29,4 +29,6 @@ | ||
29 | 29 | |
30 | 30 | |
31 | 31 | |
32 | 32 | |
33 | + | |
34 | + |
Built with git-ssb-web