-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.js
41 lines (32 loc) · 1.33 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Initializes the framework
// citizen
import config from './init/config.js'
import patterns from './init/patterns.js'
const controllers = {
hooks : await patterns.getHooks(config.citizen.directories.controllers + '/hooks'),
routes : await patterns.getRoutes(config.citizen.directories.controllers + '/routes')
},
helpers = await patterns.getHelpers(config.citizen.directories.helpers),
models = await patterns.getModels(config.citizen.directories.models),
views = await patterns.getViews(config.citizen.directories.views)
global.CTZN = {
cache : {},
config : config,
controllers : controllers,
helpers : helpers,
models : models,
views : views,
sessions : {}
}
// Exports meant for public consumption
import { clear, exists, get, set } from './lib/cache.js'
import { log } from './lib/helpers.js'
import { start } from './lib/server.js'
import { end } from './lib/session.js'
const cache = { clear, exists, get, set }
const session = { end }
// Allow either:
// import citizen from 'citizen'
export default { config, controllers, helpers, models, views, cache, log, start, session }
// import { server } from 'citizen'
export { config, controllers, helpers, models, views, cache, log, start, session }