Skip to content

Latest commit

 

History

History
76 lines (46 loc) · 1.95 KB

README.md

File metadata and controls

76 lines (46 loc) · 1.95 KB

voting-topic

A website that allows user to create new topic and voting (upvote or downvote).

Build Status

Demo site on Heroku

Demo site https://frozen-anchorage-68159.herokuapp.com/

Language

  • F/E: HTML + jQuery

  • B/E: Golang (golang >= 1.11)

Setup

  • Download the project
go get github.com/jenting/voting-topic
  • Compile and run the project
./run.sh

RESTful APIs

  • CRUD
Method URL Description
GET https://frozen-anchorage-68159.herokuapp.com/toptopic Query top 20 topic informations.
GET https://frozen-anchorage-68159.herokuapp.com/topic?uid={uid} Query topic information with specific uid.
POST https://frozen-anchorage-68159.herokuapp.com/topic Create topic with JSON body.
PUT https://frozen-anchorage-68159.herokuapp.com/topic/upvote Update upvote by 1 with specific uid in JSON body.
PUT https://frozen-anchorage-68159.herokuapp.com/topic/downvote Update downvote by 1 with specific uid in JSON body.
  • HTTP POST/PUT JSON body
Field Type(Length) Description
uid Version 4 UUID UUID
name String(255) Topic name
upvote Unsigned Integer Upvote count
downvote Unsigned Integer Downvote count

TODO

Limitations

  • Topic should not exceed 255 characters.

  • Allow user to upvote or downvote the same topic multiple times.

  • Homepage lists top 20 topics (sorted by upvotes, descending)

  • Keeps the topics in-memory data cache

  • Write test cases

  • Deploy to Heroku

Notes

  • Do not do AAA

  • Do not check duplicate votes

  • No needs in-disk database