Created
April 9, 2021 20:25
-
-
Save leightkt/953fa145d578459b4ab56a52873681f1 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
app.get('/blockchain', function (req, res) { | |
res.send(BelayChain) | |
}) | |
app.post('/addcert', function (req, res) { | |
const data = { | |
gym_id: req.body.gym_id, | |
user_member_number: req.body.user_member_number, | |
cert_type: req.body.cert_type | |
} | |
const newCertificate = BelayChain.addBlock(data) | |
res.json( { newblock: newCertificate } ) | |
}) | |
app.get('/validateChain', authenticate, function (req, res) { | |
if (BelayChain.isChainValid(BelayChain.chain)) { | |
res.json({ message: "Chain Valid"}) | |
} else { | |
res.json({ message: "Warning: Chain Invalid!"}) | |
} | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment