-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponent.js
41 lines (34 loc) · 975 Bytes
/
component.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
const fs = require('fs');
const path = require('path');
const cheerio = require('cheerio');
const JSON5 = require('json5');
class CustomError extends Error {
constructor(code, message) {
super(message);
this.code = code;
}
}
module.exports = class Component {
constructor(router, req, res) {
this.error = CustomError;
this.router = router;
this.service = router.service;
this.name = req.params.name;
this.auth = req.token.auth;
//console.log('CONSTRUCTOR: ', this.name);
/* this.user = router.user;
this.user && console.log('USER EXISTS: ', this.name, this.user);
*/
let module = path.join(__dirname, this.service, 'database', 'schema');
//this.schema = fs.existsSync(`${module}.js`) ? require(module) : void 0;
}
get data() {
return {}
}
shared(req, res) {
return {}
}
get entity() {
return {}
}
};