'use strict';
var Alexa = require("alexa-sdk");
var request = require('request');


exports.handler = function(event, context, callback) {
    var alexa = Alexa.handler(event, context);
    alexa.registerHandlers(handlers);
    alexa.execute();
};

var handlers = {
    'LaunchRequest': function () {
        this.emit('SayHello');
    },
    'HelloWorldIntent': function () {
        this.emit('SayHello')
    },
    'SayHello': function () {
        console.log('SayHello function start');
        request('http://www.chapin.edu/data/calendar/rsscache/calendar_282.rss', function (error, response, body) {
            console.log('request start');
            if (!error && response.statusCode == 200) {
                console.log(body); // Show the HTML for the Modulus homepage.
                this.emit(':tell', body);
            }
            else {
                console.log(error);
            }
        });
        
        //Lets try to make a HTTP GET request to modulus.io's website.
        request('http://www.modulus.io', function (error, response, body) {
            if (!error && response.statusCode == 200) {
                console.log(body); // Show the HTML for the Modulus homepage.
            }
        });
        
        console.log('SayHello function end');
        this.emit(':tell', "I don't see any lunch on the calendar today.");
    }
};

@@ -45,43 +45,8 @@
 %22);%0A
-var request = require('request');%0A%0A
 %0Aexp
@@ -450,24 +450,25 @@
 tart');%0A
+%0A
         
 request(
@@ -463,210 +463,265 @@
     
+const 
 request
-('http://www.chapin.edu/data/calendar/rsscache/calendar_282.rss', function (error, response, body) %7B%0A            console.log('request start');%0A            if (!error && response.statusCode == 200
+ = require('request-promise')  %0A        const options = %7B  %0A          method: 'GET',%0A          uri: 'http://www.chapin.edu/data/calendar/rsscache/calendar_282.rss'%0A        %7D%0A        %0A        request(options)  %0A          .then(function (response
 ) %7B%0A
@@ -724,36 +724,32 @@
 ) %7B%0A            
- 
-   
 console.log(body
@@ -748,102 +748,23 @@
 log(
-body); // Show the HTML for the Modulus homepage.%0A                this.emit(':tell', body
+'request ok'
 );%0A
-  
     
@@ -762,32 +762,33 @@
 k');%0A          %7D
+)
 %0A            els
@@ -786,78 +786,31 @@
     
-  else %7B%0A                console.log(error);%0A            %7D%0A        %7D);
+.catch(function (err) %7B
 %0A   
@@ -818,304 +818,143 @@
     
-%0A  
     
-  //Lets try to make a HTTP GET request to modulus.io's website.%0A        request('http://www.modulus.io', function (error, response, body) %7B%0A            if (!error && response.statusCode == 200) %7B%0A                console.log(body); // Show the HTML for the Modulus homepage.%0A
+// Something bad happened, handle the error%0A            console.log('request ERROR');%0A            console.log(err);%0A        
     
+%0A
   
-      %7D%0A
     
@@ -959,17 +959,16 @@
       %7D)
-;
 %0A       

Update index.js