Skip to content

wolfzxcv/voting-api

Repository files navigation

Simple voting API

Common Response

{
    "msg": String,
    "code": 1 success; 0 error,
    "data": Response data,
    "status": "success" or "error"
}

GET (All)

Item Value
Method GET
path /votes
param

GET (One)

Item Value
Method GET
path /vote/:id
param required

POST

Item Value
Method POST
path /vote
param optional
{
    "title": "Do you agree everyone should have the right to drink soda?"
}

PATCH

Item Value
Method PATCH
path /vote
param required
{
    "id":"ab1UunUVvHTVcGGEoe1Br", // vote id => required
    "title: "Hi everyone", // modify the tile => optional
    "option" : "win" // either "win", "lose", "draw" => required
}

DELETE

Item Value
Method DELETE
path /vote/:id
param required
  • You can list vote ids in the whitelist in db.json if you want to prevent certain ids from being deleted.

Whitelist

About

CRUD examples with lowdb

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors