mirror of
https://github.com/arnaucube/commonroutesServer.git
synced 2026-02-27 21:16:41 +01:00
added post to the commonroutesBot with travel info
This commit is contained in:
17
README.md
17
README.md
@@ -14,12 +14,13 @@
|
||||
|
||||
---
|
||||
|
||||
- server code: https://github.com/arnaucode/commonroutesServer
|
||||
- frontend app code: https://github.com/arnaucode/commonroutesApp
|
||||
- frontend webapp code: https://github.com/arnaucode/commonroutesWebApp
|
||||
- images server: https://github.com/arnaucode/goImgServer
|
||||
- admin web: https://github.com/arnaucode/commonroutesAdminWeb
|
||||
- landing page: https://github.com/arnaucode/commonroutesLandingPage
|
||||
- server code: https://github.com/arnaucube/commonroutesServer
|
||||
- frontend app code: https://github.com/arnaucube/commonroutesApp
|
||||
- frontend webapp code: https://github.com/arnaucube/commonroutesWebApp
|
||||
- images server: https://github.com/arnaucube/goImgServer
|
||||
- admin web: https://github.com/arnaucube/commonroutesAdminWeb
|
||||
- landing page: https://github.com/arnaucube/commonroutesLandingPage
|
||||
- telegram bot: https://github.com/arnaucube/commonroutesBot
|
||||
|
||||
**Backend:**
|
||||
|
||||
@@ -34,8 +35,8 @@
|
||||
|
||||
App:
|
||||
|
||||

|
||||
code: https://github.com/arnaucode/commonroutesApp
|
||||

|
||||
code: https://github.com/arnaucube/commonroutesApp
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
var request = require('request');
|
||||
|
||||
var config = require('../config');
|
||||
var pageSize=config.pageSize;
|
||||
|
||||
@@ -66,6 +68,20 @@ exports.addTravel = function(req, res) {
|
||||
travel.save(function(err, travel) {
|
||||
if(err) return res.send(500, err.message);
|
||||
|
||||
// send travel to telegram bot
|
||||
request({
|
||||
uri: 'http://127.0.0.1:3003/api/travel',
|
||||
method: 'POST',
|
||||
json: travel
|
||||
}, function (error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
// console.log(body.id) // Print the shortened url.
|
||||
} else if (error){
|
||||
console.log("error sending travel to bot: " + error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
user.travels.push(travel._id);
|
||||
user.save(function (err, user) {
|
||||
if (err) return res.send(500, err.message);
|
||||
|
||||
Reference in New Issue
Block a user