git ssb

1+

dinoworm ๐Ÿ› / catstack



Tree: e077e8e4d717d2c79b41f7287c20906ac86841db

Files: e077e8e4d717d2c79b41f7287c20906ac86841db / app / stack / index.js

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

Built with git-ssb-web