This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var request = require('request-promise'); | |
var P = require('bluebird'); | |
// Home page | |
module.exports.home = (event, context, callback) => { | |
const response = { | |
statusCode: 200, | |
body: JSON.stringify({ | |
message: 'Go Serverless v1.0! Your function executed successfully!', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Handler for /travel/{url} | |
module.exports.travel = (event, context, callback) => { | |
// Get the url from the resource path. | |
// Get the html. | |
// Turn it into a successful request. | |
// Attach the Node.js callback onto the end. | |
var url = getURLFromPath(event.path); | |
var htmlPromise = url.then(getFromURL); | |
var response = htmlPromise.then(make200Reponse); |