git ssb

2+

mixmix / ticktack



Tree: 28f088d0fbc23ee56ac8ad25e58199bd9c3262fd

Files: 28f088d0fbc23ee56ac8ad25e58199bd9c3262fd / router / sync / routes.js

718 bytesRaw
1const nest = require('depnest')
2const ref = require('ssb-ref')
3exports.gives = nest('router.sync.routes')
4
5exports.needs = nest({
6 'app.page.home': 'first',
7 'app.page.group': 'first',
8 'app.page.private': 'first'
9})
10
11exports.create = (api) => {
12 return nest('router.sync.routes', (sofar = []) => {
13 const pages = api.app.page
14 // route format: [ routeValidator, routeFunction ]
15
16 const routes = [
17 [ location => location.page === 'home', pages.home ],
18 [ location => location.type === 'group', pages.group ],
19 [ location => location.page === 'channel', pages.channel ],
20 [ location => ref.isMsg(location.key), pages.private ]
21 ]
22
23 return [...routes, ...sofar]
24 })
25}
26
27
28
29
30
31
32
33
34
35
36

Built with git-ssb-web