-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
101 lines (87 loc) · 2.04 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
'use strict';
/**
* @module Role
* @name Role
* @description An entity that defines how a party(ies) acts or, in other words,
* what roles the party(ies) plays in specific context or environment.
*
* It defines set of permissions(or access rights) that are
* applicable to to a specific party(ies).
*
* @author lally elias <[email protected]>
* @licence MIT
* @since 0.1.0
* @version 0.1.0
* @example
*
* const { app } = require('@lykmapipo/role');
* app.start();
*
*/
/* dependencies */
const { include } = require('@lykmapipo/include');
const { pkg } = require('@lykmapipo/common');
const { apiVersion } = require('@lykmapipo/env');
const { app, mount } = require('@lykmapipo/express-common');
const Role = include(__dirname, 'lib', 'role.model');
const roleRouter = include(__dirname, 'lib', 'role.http.router');
/**
* @name info
* @description package information
* @type {Object}
*
* @author lally elias <[email protected]>
* @since 0.3.0
* @version 0.1.0
*/
exports.info = pkg(
`${__dirname}/package.json`,
'name', 'description', 'version', 'license',
'homepage', 'repository', 'bugs', 'sandbox', 'contributors'
);
/**
* @name Role
* @description Role model
* @type {mongoose.Model}
*
* @author lally elias <[email protected]>
* @since 0.3.0
* @version 0.1.0
*/
exports.Role = Role;
/**
* @name roleRouter
* @description role http router
* @type {express.Router}
*
* @author lally elias <[email protected]>
* @since 0.3.0
* @version 0.1.0
*/
exports.roleRouter = roleRouter;
/**
* @name apiVersion
* @description http router api version
* @type {String}
*
* @author lally elias <[email protected]>
* @since 0.3.0
* @version 0.1.0
*/
exports.apiVersion = apiVersion();
/**
* @name app
* @description express app
* @type {Object}
*
* @author lally elias <[email protected]>
* @since 0.1.0
* @version 0.1.0
*/
Object.defineProperty(exports, 'app', {
get() {
/* @todo bind oauth middlewares authenticate, token, authorize */
mount(roleRouter);
return app;
}
});