|
|
|
|
|
|
|
|
|
|
|
|
|
|
var app = express(); |
|
|
var app = express(); |
|
|
|
|
|
|
|
|
var http_port=8888; |
|
|
|
|
|
|
|
|
var http_port=8013; |
|
|
https_port=8889; |
|
|
https_port=8889; |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//require('./app/routes/message.route.js')(app); |
|
|
//require('./app/routes/message.route.js')(app); |
|
|
|
|
|
|
|
|
app.get ('api/ids', function (req, res) { |
|
|
|
|
|
|
|
|
app.get ('/api/ids', function (req, res) { |
|
|
Message.find({},{id: true}) .exec () .then(results => { |
|
|
Message.find({},{id: true}) .exec () .then(results => { |
|
|
//selects id from message: |
|
|
//selects id from message: |
|
|
var parsed = []; |
|
|
var parsed = []; |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
app.get ("api/msg/:id", function (req, res) { |
|
|
|
|
|
|
|
|
app.get ("/api/msg/:id", function (req, res) { |
|
|
Message.findOne ({_id: req.params.id}) .exec (function (err, results){ |
|
|
Message.findOne ({_id: req.params.id}) .exec (function (err, results){ |
|
|
if (err) { |
|
|
if (err) { |
|
|
console.log (err); |
|
|
console.log (err); |
|
|
|
|
|
|
|
|
return text; |
|
|
return text; |
|
|
}*/ |
|
|
}*/ |
|
|
|
|
|
|
|
|
app.post("api/createMsg", function(req, res){ |
|
|
|
|
|
|
|
|
app.post("/api/createMsg", function(req, res){ |
|
|
//x = mongoose.Types.ObjectId(); |
|
|
//x = mongoose.Types.ObjectId(); |
|
|
//y = x.toString(); |
|
|
//y = x.toString(); |
|
|
//var z = makeid(); |
|
|
//var z = makeid(); |