Skip to content

slower-master/iitk-coin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IITK Coin

SnT Project 2021, Programming Club

This repository contains the code for the IITK Coin project done so far.

Relevant Links

Table Of Content

Development Environment

- go version: go1.16.4 linux/amd64   
- OS: ubuntu-20.04 LTS   
- text editor: VSCode    	
- terminal: ubuntu terminal 

Directory Structure

.
├── README.md
├── functions
│   └── functiuons.go
├── handlers
│   └── handlers.go
├── go.mod
├── go.sum
├── coindatabase.db
├── main.go

2 directories, 6 files

Usage

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-coin

Output 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

Endpoints

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

Models

  • 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"`

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors