This repository contains the code for the IITK Coin project done so far.
- go version: go1.16.4 linux/amd64
- OS: ubuntu-20.04 LTS
- text editor: VSCode
- terminal: ubuntu terminal .
├── README.md
├── functions
│ └── functiuons.go
├── handlers
│ └── handlers.go
├── go.mod
├── go.sum
├── coindatabase.db
├── main.go
2 directories, 6 files
cd $GOPATH/src/github.com/<username>
git clone https://github.com/dinesh-cpu/iitk-coin.git
cd repo
go run main.go
#, or build the program and run the executable
go build
./iitk-coinOutput should look like
2021/06/20 23:59:40 FINALDATA table created (if not existed) successfully!
2021/06/20 23:59:40 EVENTS table created (if not existed) successfully!
2021/06/20 23:59:40 REDEEM table created (if not existed) successfully!
2021/06/20 23:59:40 Serving at 8080
POST requests take place via JSON requests. A typical usage would look like
/login:POST
{"rollno":"<rollno>", "password":"<password>"}/signup:POST
{"name":"<username>","rollno":"<user rollno>", "password":"<password>","batch":"<user batch>"}/logout:POST
/redeemcoins:POST
{"coin":"<How much coin want to redeem>", "item":"item name"}/acion:POST
{"id":"<Id of redeem request>", "action":"<0 or 1>"}GET requests:
/pendingrequests:GET
curl http://localhost:8080/pendingrequests/getcoin:GET
curl http://localhost:8080/getcoin- Credentials
Name string `json:"username"`
Password string `json:"password"`
Rollno int `json:"rollno"`
Batch string `json:"batch"`- Redeem
Coin int `json:"coin"`
Item string `json:"item"`- Transfercoin
Rollno2 int `json:"rollno1"`
Coin int `json:"coin"`