The Retrieve Data Block endpoint is responsible for fetching the block data (Profile or Session) from your database. OwnID will send a request to this endpoint, specifying the block type it needs to retrieve.
app.get('/providers/storage/:blockType', (req, res) => {
const { blockType } = req.params;
const blockData = getBlockData(blockType);
if (blockData) {
res.status(200).json(blockData);
} else {
res.status(404).send('Data for the specified blockType not found.');
}
});
app.post('/providers/storage/:blockType', (req, res) => {
const { blockType } = req.params;
const newData = req.body;
const success = updateBlockData(blockType, newData);
if (success) {
res.status(200).send('Data updated successfully.');
} else {
res.status(404).send('Data for the specified blockType not found.');
}
});