npm install
npm run serve
npm run build
npm run lint
| METHOD | API NAME | DESCRIPTION | INPUT | RETURNS |
|---|---|---|---|---|
| POST | /api/upload_file | Uploads an image to the server. | Formdata name="image"; filename="some.png"; name="battleId"; name="username" | {"fieldCount":0,"affectedRows":1,"insertId":19,"serverStatus":2,"warningCount":0,"message":"","protocol41":true,"changedRows":0} |
| GET | /api/images | Returns images from the server. | ?path= String | Image file if any |
| GET | /api/submissionData | Links an uploaded file with the user and the cup it was posted to. | ?id= Number | [{"id": int, "imageFilepath": String}] |
| POST | /api/createUser | Creates a user. | {username: "string", password: "string"} | Mysql Response Json |
| POST | /api/login | Logs a user in. | {"user":{"username": String,"password": String},"token": String} | |
| POST | /api/verify | Checks if credentials are correct. | { token: "example"} | { "error":false,"data":{"username":"string","password":"string","iat":0,"exp":0},"verify":true} |
| POST | /api/userstats | Returns cup stats of an user. | {username: String} | [{"userName":String ,"wins": int,"participations": int}] |
| PATCH | /api/usersubs | Updates user's submissioncount. | {username: String} | - |
| PUT | /api/newVote | Inputs a new vote on a picture into database. | { vote: Number, id: Number, battleId: Number, token: Number } | {"fieldCount": int ,"affectedRows": int,"insertId": int,"serverStatus": int,"warningCount": int,"message": String ,"protocol41": boolean, "changedRows": int} |
| GET | /api/getOpenCups | Returns active cups. | - | [{"id": int,"winnerUserName":null, "endDate": Date,"category": String,"retired":null ,"cupType": int}] |
| GET | /api/leaderboards | Returns all cups. | ?id=3 | [{"id": int,"winnerUserName": null, "endDate": Date,"category": String,"retired":null, "cupType": int}] |
| OPTIONS | * | Accepts Cross-Origin options from all paths | - | - |