Last active
July 5, 2019 13:01
-
-
Save theburningmonk/c08e5762a4c6eb757b475d237e1cf4c9 to your computer and use it in GitHub Desktop.
This file contains 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
module.exports.handler = co.wrap(function* (event, context, callback) { | |
let players = lib.genPlayers(); | |
let accept = event.headers.Accept || "application/json"; | |
switch (accept) { | |
case "application/x-protobuf": | |
let response = yield protoResponse(players, "functions/player.proto", "protodemo.Players"); | |
callback(null, response); | |
break; | |
case "application/json": | |
callback(null, jsonResponse(players)); | |
break; | |
default: | |
callback(null, NotAcceptableResponse); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment