Simple REST API to make polls.
go get github.com/drklee3/polls-api
go build
./polls-api
Configuration options are read from environment variables, optionally loaded from an .env
file. The variables used are given below with example values. Default values for INTERFACE
, PORT
, or DB_LOG
if not given are 127.0.0.1
, 3000
, false
respectively.
DB_USERNAME=admin
DB_PASSWORD=Hunter2
DB_NAME=polls
DB_HOST=127.0.0.1
# optional variables
INTERFACE=127.0.0.1 # web server interface
PORT=3000 # web server port
DB_LOG=1 # gorm logging
ORIGIN_ALLOWED=* # CORS allowed origins
GET
Get all pollsPOST
Create a new poll
GET
Get a single pollPUT
Update a pollDELETE
Delete a poll
POST
Vote on a poll
PUT
Archive a poll (disables votes)DELETE
Restores a poll (re-enables votes)