-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
77 lines (65 loc) · 1.52 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
'use strict';
/**
* @name majifix-service-request
* @description A representation of an issue(or service request)
* reported by a civilian(or customer) e.g Water Leakage occur at
* a particular area.
*
* @author lally elias <[email protected]>
* @author Benson Maruchu <[email protected]>
* @since 0.1.0
* @version 0.1.0
* @license MIT
* @example
*
* const { app } = require('majifix-service-request');
*
* ...
*
* app.start();
*
*
*/
/* dependencies */
const path = require('path');
const _ = require('lodash');
const { app, mount } = require('@lykmapipo/express-common');
/* declarations */
const pkg = require(path.join(__dirname, 'package.json'));
const fields = [
'name',
'description',
'version',
'license',
'homepage',
'repository',
'bugs',
'sandbox',
'contributors',
];
const info = _.merge({}, _.pick(pkg, fields));
/* import models */
const ServiceRequest = require(path.join(
__dirname,
'lib',
'servicerequest.model'
));
/* import routers*/
const router = require(path.join(__dirname, 'lib', 'http.router'));
/* export package(module) info */
exports.info = info;
/* export service request model */
exports.ServiceRequest = ServiceRequest;
/* export service request router */
exports.router = router;
/* export router api version */
exports.apiVersion = router.version;
/* export app */
Object.defineProperty(exports, 'app', {
get() {
//TODO bind oauth middlewares authenticate, token, authorize
/* bind service request router */
mount(router);
return app;
},
});