git ssb

1+

dinoworm ๐Ÿ› / catstack



Tree: d257f1cb78aa333ab6399429df9d754ce4f561f5

Files: d257f1cb78aa333ab6399429df9d754ce4f561f5 / app / stack / index.js

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

Built with git-ssb-web