-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiv1.js
30 lines (24 loc) · 821 Bytes
/
apiv1.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
var express = require('express');
var router = express.Router();
var mongoTools=require("./mongoTools.js");
router.get('/', function(req, res) {
res.send('Nothing to do here');
});
router.get('/time',function(req,res){
res.send(Date.now().toString());
})
router.post("/setConnection",function(req,res){
mongoTools.setConnection(req.body,function(err){
err ? res.send({"message":"Check your params :'C","success":false}) : res.send({"message":"Done!","success":true});
});
})
router.get("/getDBNames",function(req,res){
mongoTools.getDBNames(res);
})
router.get("/getCommonCollections/:origin/:destination",function(req,res){
mongoTools.getCommonCollections(req.params,function(err,col){
if(err) res.send({message:"Something went wrong :'C"});
res.send(col);
})
})
module.exports = router;