Created
October 13, 2019 15:41
-
-
Save userhooke/24450b59159d063d76cdc1d8ae627b61 to your computer and use it in GitHub Desktop.
Simple Express server to test Lambda functions locally
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 express = require('express'); | |
// path to lambda function | |
const getAccountDetails = require('../get-account-details/src/index'); | |
const app = express(); | |
app.use(express.json()); | |
app.use(express.urlencoded({ extended: true })); | |
app.post('/', async (req, res) => { | |
// calling lambda function | |
return getAccountDetails.handler({ | |
body: JSON.stringify({ | |
password: req.body.password, | |
edrpou: req.body.edrpou, | |
}), | |
}) | |
.then(response => response) | |
.catch(error => error); | |
}); | |
app.listen(process.env.PORT, () => console.log(`App listening on port ${process.env.PORT}!`)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment