Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
Created June 5, 2018 16:44
Show Gist options
  • Save sergiolucero/85230d18152d7cceb59ad6dae47acb0a to your computer and use it in GitHub Desktop.
Save sergiolucero/85230d18152d7cceb59ad6dae47acb0a to your computer and use it in GitHub Desktop.
Primer deployment serverless en Amazon Lambda
'use strict';
module.exports.hello = (event, context, callback) => {
const response = {
statusCode: 200,
body: JSON.stringify({
message: 'hola Sergio!',
}),
};
callback(null, response);
};
@sergiolucero
Copy link
Author

Donde el código importado vía const {extractListingsFromHTML} = require('./helpers') es

const cheerio = require('cheerio');
const moment = require('moment');

function extractListingsFromHTML (html) {
  const $ = cheerio.load(html);
  const urls = $('div.listing-item__header');

  urls.each((i, el) => {

    let url = $(el).children('a.').first().href().trim();
    vacancies.push({url});
  });

  return vacancies;
}

Pero obviamente escrito en JavaScript correcto!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment