Skip to content

Instantly share code, notes, and snippets.

@melvinlee
Created April 7, 2018 04:29
Show Gist options
  • Save melvinlee/c37cabb342df71045db227edb40f3930 to your computer and use it in GitHub Desktop.
Save melvinlee/c37cabb342df71045db227edb40f3930 to your computer and use it in GitHub Desktop.
AWS nodejs lamba to return html content from file.
'use strict';
var fs = require('fs');
exports.get = function(event, context) {
let contents = fs.readFileSync("public/index.html");
context.succeed({
statusCode: 200,
body: contents.toString(),
headers: {'Content-Type': 'text/html'}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment