Created
November 4, 2018 23:32
-
-
Save linux08/6b45b2c62da0eabce588637dff3fda85 to your computer and use it in GitHub Desktop.
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
exports.postData = async (req, res, next) => { | |
try { | |
const { hash } = req.data[0]; | |
const accounts = await web3.eth.getAccounts(); | |
const resp = await SavingContract.methods.saveHash(hash) | |
.send({ | |
from: accounts[0], | |
}); | |
const data = Object.assign({ ipfsHash: hash }, resp); | |
req.data = data; | |
next(); | |
} catch (err) { | |
res.status(500).send(err.message); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment