-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
53 lines (36 loc) · 1.08 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
'use strict';
var logger, config, app;
var hdfs_schema = require('./system_schema');
var api = {
_config: undefined,
schema: function() {
return hdfs_schema.config_schema();
},
config: function(pluginConfig) {
this._config = pluginConfig;
logger = pluginConfig.logger;
app = pluginConfig.app;
config = pluginConfig.server_config;
},
static: function() {
return __dirname + '/static';
},
init: function() {
},
pre: function() {
},
routes: function() {
var config = this._config;
var hdfsDownload = require('./server/api/hdfs_download')(config);
var hdfsUpload = require('./server/api/hdfs_upload')(config);
var hdfsDelete = require('./server/api/hdfs_delete')(config);
function hdfs(req, res) {
var routes = {GET: hdfsDownload, POST: hdfsUpload, PUT: hdfsUpload, DELETE: hdfsDelete};
routes[req.method](req, res);
}
app.use('/api/v1/hdfs/:id/', hdfs);
},
post: function() {
}
};
module.exports = api;