-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiProxyRoutes.js
50 lines (43 loc) · 1.17 KB
/
apiProxyRoutes.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
'use strict';
var express = require('express');
var request = require('request');
var router = express.Router();
router.get('/task/list', function(req, res){
request.get('http://todo.ceresti.com:8080/task/list',
function (error, response, body) {
res.send(body);
}
);
});
router.put('/task/:id', function(req, res){
request.put(
{ url : 'http://todo.ceresti.com:8080/task/' + req.params.id,
json : true,
body : req.body },
function(error, response, body){
res.send(body);
});
});
router.delete('/task/delete/:id', function(req, res){
request.del('http://todo.ceresti.com:8080/task/delete/' + req.params.id,
function(error, response, body){
res.send(body);
});
});
router.post('/task/add', function(req, res){
request.post(
{ url : 'http://todo.ceresti.com:8080/task/add',
json : true,
body : req.body
},
function(error, response, body){
res.send(body);
});
});
// router.get('/task/:id', function(req, res){
// request.get('http://todo.ceresti.com:8080/task/'+req.params.id,
// function(error, response, body){
// res.send(body);
// });
// });
module.exports = router;