Created
November 7, 2018 06:32
-
-
Save milannankov/f7bc8f5adfeabea55af729221bbee002 to your computer and use it in GitHub Desktop.
Serverless Backend for Data Transformation (Part 1) - updated index.js
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
const transformStatement = require('./bank-statement-transform'); | |
module.exports = function (context, req) { | |
if (req.body) { | |
let statement = req.body.toString(); | |
let transformedStatement = transformStatement(statement); | |
context.res = { | |
body: transformedStatement, | |
headers: { | |
'Content-Type': 'text/csv' | |
} | |
}; | |
} | |
else { | |
context.res = { | |
status: 400, | |
body: "Please pass a file for processing" | |
}; | |
} | |
context.done(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment