Skip to content

Instantly share code, notes, and snippets.

@theburningmonk
Created August 28, 2017 16:37
Show Gist options
  • Save theburningmonk/7017ddfadf779bfc1d41ad3398c075c3 to your computer and use it in GitHub Desktop.
Save theburningmonk/7017ddfadf779bfc1d41ad3398c075c3 to your computer and use it in GitHub Desktop.
'use strict';
const co = require('co');
const log = require('../lib/log');
const snsHandler = require('../lib/snsHandler');
const http = require('../lib/http');
const reqContext = require('../lib/requestContext');
module.exports.handler = snsHandler(
co.wrap(function* (event, context) {
reqContext.set("source-type", "sns");
log.debug("this is a DEBUG log");
log.info("this is an INFO log");
log.warn("this is a WARNING log");
log.error("this is an ERROR log");
let host = reqContext.get()["x-correlation-host"];
if (host) {
let uri = `https://${host}/dev/api-c`;
log.info("calling api-c", { uri });
let reply = yield http({
uri : uri,
method : 'GET'
});
log.info(reply);
}
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment