-
Notifications
You must be signed in to change notification settings - Fork 0
/
webUtil.js
52 lines (40 loc) · 869 Bytes
/
webUtil.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
//route for http methods
var url = require('url');
var qs = require('querystring');
var mongoloideloide = require('./mongoloideUtil');
//web.proxy(req.method, req);
module.exports = {
proxy: function(method, req){
if(method === 'GET'){
var queryObject = url.parse(req.url,true).query;
} else if(method === 'POST'){
var aluno;
aluno = parse(req);
insert(aluno);
} else if(method === 'PUT'){
update();
} else if(method === 'DELETE'){
deleta();
}
}
}
var insert = function(aluno){
console.log('inserindo...');
mongoloide.insert(aluno);
};
var update = function(){
mongoloide.update();
return("update");
};
var deleta = function(){
mongoloide.deleta();
return("delete");
};
var getAll = function(){
mongoloide.getAll();
};
var get = function(){
console.log("get");
mongoloide.get();
return("get");
};