1.0.0 • Published 10 years ago
aws-lambda-web v1.0.0
AWS Lambda Web
Provides Web Platform API features for AWS Lambda functions.
Currently supported (on global object):
Small example of using promises and fetch API:
require('aws-lambda-web')(exports, function handler(event) {
return fetch('https://www.google.com/search?q=' + encodeURIComponent(event.search)).then(function(response) {
return response.text();
}).then(function(text) {
var rx = /<h3 class="r"><a href="(?:\/url\?q=)?([^&>"]+)[^>]*>([^<]+)<\/a><\/h3>/;
var match = text.match(rx);
if (match) {
return {
link: match[1],
text: match[2]
};
}
});
});
1.0.0
10 years ago