DEV Community

Cover image for Dev OPinion - Netlify Dynamic Site Challenge Submission
Ishaan Sheikh
Ishaan Sheikh

Posted on • Edited on

4 1

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 -

GitHub logo frikishaan / devopinion

App for the Netlify Dynamic Site Challenge




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]
Enter fullscreen mode Exit fullscreen mode

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]);
Enter fullscreen mode Exit fullscreen mode

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

await store.get(key, {
    type: "json",
});
Enter fullscreen mode Exit fullscreen mode

Netlify Functions

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

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

Top comments (4)

Collapse
 
philiphow profile image
Philip How

Haha - very well played. Good job.

Collapse
 
frikishaan profile image
Ishaan Sheikh

Thanks!

Collapse
 
jsha profile image
Julia Shlykova

I like that you blocked option 'other platform' :)

Collapse
 
frikishaan profile image
Ishaan Sheikh

Why choose others if you have Netlify 😉

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay