Skip to content

Instantly share code, notes, and snippets.

@leightkt
Created April 9, 2021 20:25
Show Gist options
  • Save leightkt/953fa145d578459b4ab56a52873681f1 to your computer and use it in GitHub Desktop.
Save leightkt/953fa145d578459b4ab56a52873681f1 to your computer and use it in GitHub Desktop.
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