Code Monkey home page Code Monkey logo

polls's Introduction

To Run:

In terminal, cd to an empty directory:

git clone https://github.com/Matthew-Herman/polls.git
cd to polls
npm install
node app.js

In a browser on the computer which is running app.js: navigate to "localhost:3000"

Assumptions: I represent the polls as an array in the web server memory as no API is provided. I would expect polls to be in a database and there would be an API for updating polls in the database on the frontend.

Because there is no database, for each poll, I add the number of votes for each option as a property on each option in the poll's "options" array

It wasn't in the spec so I simply didn't render the chart if votes = 0.

As I didn't use a CSS preprocessor I didn't check for browser compatibility and insert necessary prefixes. I only tested with the newest version of Chrome.

No spec for tracking session or authentication was provided so I am not properly tracking state, eg. userHasAlreadyVoted, in the clientside state. I would expect this to be stored in session on a real website. Also as there is no system for handling errors I just store state on the Vue component and there is no rendering depending on errors from AJAX calls.

I oversimplified the AJAX calls for the voting as there is no API.

I just used the compiled production vue. I didn't want to complicate this project by building vue or using a CSS preprocessor, so I wrote components and css in the same file for simplicity. On a larger project I would expect to components to be in single file components and a more complex routing system.

Given more time I would also create child components for "detailPost" instead of reusing the components for "todayPost".

polls's People

Contributors

matthew-herman avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.