Below is my lambda function. It returns a promise instead using the callback. I wonder how I can return different http status code to API gateway?
exports.handler = async (event, context) => {
return new Promise((resolve, reject) => {
const options = {
...
};
const req = http.request(options, (res) => {
resolve('Success');
});
req.on('error', (e) => {
reject(e.message);
});
// send the request
req.write('');
req.end();
});
};