Skip to content

Instantly share code, notes, and snippets.

View krstoff's full-sized avatar

Kristoffer Semelka krstoff

  • San Francisco, CA
View GitHub Profile
'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!',
/// 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);