Skip to content

A website allow users to create new topic and voting

License

Notifications You must be signed in to change notification settings

jenting/voting-topic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/hsiaoairplane/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

About

A website allow users to create new topic and voting

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages