git ssb

1+

dinoworm ๐Ÿ› / catstack



Tree: 99bc16e5212f7086422943407911f7c31443ab4c

Files: 99bc16e5212f7086422943407911f7c31443ab4c / app / stack / index.js

658 bytesRaw
1import feathers from 'feathers'
2import { mapObjIndexed, reduce, toPairs } from 'ramda'
3
4const stackCreators = {
5 services: require('./services'),
6 static: require('./static'),
7 render: require('./render')
8}
9
10export default function createStack(config) {
11 const stacks = createStacks(config)
12
13 const app = feathers()
14
15 useAll(app, stacks)
16
17 return app
18}
19
20function createStacks (config) {
21 return mapObjIndexed(
22 (stackCreator, name) => {
23 return stackCreator(config[name])
24 },
25 stackCreators
26 )
27}
28
29function useAll (app, services) {
30 return reduce((app, [name, service]) => {
31 return app.use(service)
32 }, app, toPairs(services))
33}
34
35

Built with git-ssb-web