I am trying to experiment with AWS Lambda and I am using Serverless CLI for my deployment. I am using aws-nodejs template to generate my project folder.
This is the handler.js code:
'use strict';
module.exports.hello = async (event, context) => {
return {
statusCode: 200,
body: {
"message":
'Hello World! Today is '+new Date().toDateString()
}
};
// Use this code if you don't use the http event with the LAMBDA-PROXY integration
// return { message: 'Go Serverless v1.0! Your function executed successfully!', event };
};
I am getting a successful response in JSON format. I am trying to tweak it to return HTML response. Should I change the content-type for that? If so how?
I have gone through the below questions:
and a few others as well. But all of them are using the web console and the API gateway which I am not using.