Dev OPinion – Netlify Dynamic Site Challenge Submission

Dev OPinion – Netlify Dynamic Site Challenge Submission

This is a submission for the Netlify Dynamic Site Challenge: Build with Blobs.

What I Built

I have built an online poll for the common questions between developers. Each question has two options. Users can choose any one option. The votes are recorded anonymously.

Demo

The demo is available here – devopinion.netlify.app

Source Code on GitHub –


frikishaan
/
devopinion

App for the Netlify Dynamic Site Challenge

Dev OPinion

It is a app created for Netlify Dynamic Site challenge on Dev.

Tech stack

Nuxt.js
Netlify
Netlify Blob (for storage)

Platform Primitives

Netlify Blobs

I have used Netlify Blobs to store the votes for each question.

Each blob holds a JSON array of votes for each option. Below is an example of data stored in a blob.

[341, 1231]

Here, the first element in the array is the number of votes for the first option and the second element is a number of votes for the second option.

I have used the setJSON method to set the value as json in the blob.

await store.setJSON(key, [131, 231]);

To get the value as JSON I have used the following code

await store.get(key, {
type: json,
});

Netlify Functions

I have used the Netlify functions as API to fetch and add votes in the blob storage.

Leave a Reply

Your email address will not be published. Required fields are marked *