An Voting Server to determine an issue about Wuhan Coronavirus: determining whether Wuhan Coronavirus is created by China. The user can vote agree or disagree at any time.
- Ruby 2.7.2
- Database: SQLite
- run
bundle install
to install gems and node modules - run
bundle exec rails db:migrate
- run
bundle exec rails db:seed
to seed users and issue
POST /api/sign_up
withemail
,password
- e.g.
curl -X POST "127.0.0.1:3000/api/sign_up" -d "email=new@test.test&password=mypass"
- e.g.
POST /api/login
withemail
,password
to getauth_token
- e.g.
curl -X POST "127.0.0.1:3000/api/login" -d "email=user1@test.test&password=mypass"
- e.g.
GET /api/issues
to get all issuesGET /api/issues/:id
to get issue info- e.g.
curl -X GET "127.0.0.1:3000/api/issues/1"
- e.g.
PATCH /api/issues/:id
withauth_token
andagree
to vote,agree
istrue
orfalse
- e.g.
curl -X PATCH "127.0.0.1:3000/api/issues/1" -d "auth_token=pY6m75tJujDFcik1hHKyhY1x&agree=0"
for user1 to vote disagree - duplicated vote for the same user on same issues will modify previous results
- e.g.
rspec
rails s
It will serve on 127.0.0.1:3000
by default.
2.5 hr