Skip to content

fadhildaffa/IP-RMT42

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Review Assignment Due Date Open in Visual Studio Code

Individual Project Phase 2 Daffa Muhammad Fadhil

API Docs

My First Individual Server

My Individual Server Project is a server application that has several end points and will later be used to hiring partner. This app has :

  • RESTful endpoint for asset's CRUD operation
  • JSON formatted response

RESTful endpoints

POST /register

Register before using this web

Request Header

not needed

Request Body

{
  "name" : "string",
  "email" : "string",
  "password" : "string"
}

Response (201 - Created)

{
    "id" : "integer",
    "email" : "string"
}

Response (400 - Bad Request)

{
  "message": "Email is missing"
}
  OR
{
  "message": "Password is missing"
}

Response (500 - Internal Server)

{
  "message": "Internal server error"
}

POST /login

Get acces token for login

Request Header

not needed

Request Body

{
  "email" : "string",
  "password" : "string"
}

Response (200 - Ok)

{
    "access_token" = "string"
}

Response (400 - Bad Request)

{
  "message": "Email is missing"
}
  OR
{
  "message": "Password is missing"
}

Response (401 - Bad Request)

{
  "message": "Invalid email/password"
}

Response (500 - Internal Server)

{
  "message": "Internal server error"
}

GET /teams

Get All Teams

Request Header

{
  "Authorization": "string"
}

Request Body

not needed

Response (200 - Ok)

[
    {
    "id": "integer,
    "name": "string",
    "logo": "string",
    "win": "integer",
    "draw":"integer",
    "lose": "integer",
    "goal_average": "integer",
    "clean_sheet": "integer",
    "failed_to_score": "integer",
    "authorId": "integer",
    "createdAt": "date",
    "updatedAt": "date"
 },
 ...
 ]

Response (500 - Internal Server)

{
  "message": "Internal server error"
}

POST /teams

create new team

Request Header

{
  "Authorization": "string"
}

Request Body

{
    "id": "integer,
    "name": "string",
    "logo": "string",
    "win": "integer",
    "draw":"integer",
    "lose": "integer",
    "goal_average": "integer",
    "clean_sheet": "integer",
    "failed_to_score": "integer",
    "authorId": "integer",
 }

Response (201 - created)

{
    "id": "integer,
    "name": "string",
    "logo": "string",
    "win": "integer",
    "draw":"integer",
    "lose": "integer",
    "goal_average": "integer",
    "clean_sheet": "integer",
    "failed_to_score": "integer",
    "authorId": "integer",
    "createdAt": "date",
    "updatedAt": "date"
 }

Response (400 - Bad Request)

{
  "message": "Name is required"
}
    OR
{
  "message": "Win is required"
}
    OR
{
  "message": "Lose is required"
}
    OR
{
  "message": "Clean Sheet is required"
}
    OR
{
  "message": "Average Goal is required"
}
    OR
{
  "message": "Fail to Score is required"
}
    OR
{
  "message": "Author Id is required"
}
{
  "message": "Win must be a number"
}
    OR
{
  "message": "Lose must be a number"
}
    OR
{
  "message": "Clean Sheet must be a number"
}
    OR
{
  "message": "Average Goal must be a number"
}
    OR
{
  "message": "Fail to Score must be a number"
}

Response (500 - Internal Server)

{
  "message": "Internal server error"
}

GET /team/:id

Get team by id

Request Header

{
  "Authorization": "string"
}

Request Params

{
    "id" : "integer"
}

Request Body

not needed

Response (200 - OK)

{
    "id": "integer,
    "name": "string",
    "logo": "string",
    "win": "integer",
    "draw":"integer",
    "lose": "integer",
    "goal_average": "integer",
    "clean_sheet": "integer",
    "failed_to_score": "integer",
    "authorId": "integer",
 }

Response (404 - Not Found)

{
  "message": "Error not found"
}

Response (500 - Internal Server)

{
  "message": "Internal server error"
}

PUT /teams/:id

Update team by id

Request Header

{
  "Authorization": "string"
}

Request Params

{
    "id" : "integer"
}

Request Body

{
    "id": "integer,
    "name": "string",
    "logo": "string",
    "win": "integer",
    "draw":"integer",
    "lose": "integer",
    "goal_average": "integer",
    "clean_sheet": "integer",
    "failed_to_score": "integer",
    "authorId": "integer",
 }

Response (200 - OK)

{
    "id": "integer,
    "name": "string",
    "logo": "string",
    "win": "integer",
    "draw":"integer",
    "lose": "integer",
    "goal_average": "integer",
    "clean_sheet": "integer",
    "failed_to_score": "integer",
    "authorId": "integer",
 }

Response (400 - Bad Request)

{
  "message": "Name is required"
}
    OR
{
  "message": "Win is required"
}
    OR
{
  "message": "Lose is required"
}
    OR
{
  "message": "Clean Sheet is required"
}
    OR
{
  "message": "Average Goal is required"
}
    OR
{
  "message": "Fail to Score is required"
}
    OR
{
  "message": "Author Id is required"
}
{
  "message": "Win must be a number"
}
    OR
{
  "message": "Lose must be a number"
}
    OR
{
  "message": "Clean Sheet must be a number"
}
    OR
{
  "message": "Average Goal must be a number"
}
    OR
{
  "message": "Fail to Score must be a number"
}

Response (404 - Not Found)

{
  "message": "Error not found"
}

Response (500 - Internal Server)

{
  "message": "Internal server error"
}

DELETE /teams/:id

Delete team by id

Request Header

{
  "Authorization": "string"
}

Request Params

{
    "id" : "integer"
}

Request Body

not needed

Response (200 - Ok)

{
   "message" : "Team (name of team) succes deleted from list "
}

Response (404 - Not Found)

{
  "message": "Error not found"
}

Response (500 - Internal Server)

{
  "message": "Internal server error"
}

PATCH /user/payment/midtrans

Update imgUrl using file

Request Header

{
  "Authorization": "string"
}

Request Params

not needed

Request Body (multiform/data)

{
  midtrans: "string"
}

Response (200 - OK)

{
   "message" : "Payment succesfull"
}

Response (400 - Bad Request)

{
  "message": "payment failed"
}

Response (500 - Internal Server)

{
  "message": "Internal server error"
}

About

ip-rmt42 created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • HTML 59.3%
  • JavaScript 38.7%
  • CSS 2.0%