Guest User

Untitled

a guest
May 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. //request.js
  2.  
  3. var request = require('request');
  4.  
  5. request.get('http://177.77.44.99:8081/gall/cesar.txt',function(error, response, body){
  6. console.log('error:', error);
  7. console.log('body:', body);
  8. });
  9.  
  10. function handler(req, res){
  11. request.get('http://177.77.44.99:8081/gall/cesar.txt',function(error, response, body){
  12. if(error) {
  13. // res.redirect('/') ответ в результате ошибки
  14. } else {
  15. res.render('name.ejs', {result : body})
  16. }
  17. })
  18. }
  19.  
  20. app.get('path', handler);
Add Comment
Please, Sign In to add comment