Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sultan Rayhan Habib #19

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
371 changes: 370 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,370 @@
# hacktivoverflow
# hacktivoverflow

# rest-api

# HACKTIVOVERFLOW


#### REST API built Express and Mongoose


##### List of user Routes

### POST user/register
***
to register new User
#### URL
http://34.87.7.44/user/register

#### METHOD
POST
#### URL PARAMS
none
#### data
username : STRING (required)
email : STRING (required)
password : STRING (required)
#### Succes Response
{
token : '<your token>',
user : {
"_id": "5d8067d979d2453f9d4e08b6",
"username": "ando5",
"password": "$2a$10$FKUNaNVmJrEfMia3usm4.uiP7eu61vaqZ9pShy.5g1UUnTR..vNie",
"email": "[email protected]",
"watchedTag" : []
"__v": 0
}
}
#### Error Response


{
"message": ""User validation failed: username: Path `username` is required",
"data": ""User validation failed: username: Path `username` is required"
}
status : 400 (Bad Request)
.

{
"message": "internal server error",
}
status : 500 (INTERNAL SERVER ERROR)

### POST user/login
***
to login User
#### URL
http://34.87.7.44/user/login

#### METHOD
POST
#### URL PARAMS
none
#### data
email : STRING (required)
password : STRING (required)
#### Succes Response
{
token : '<your token>',
user : {
"_id": "5d8067d979d2453f9d4e08b6",
"username": "ando5",
"password": "$2a$10$FKUNaNVmJrEfMia3usm4.uiP7eu61vaqZ9pShy.5g1UUnTR..vNie",
"email": "[email protected]",
"__v": 0
}
}
#### Error Response


{
"message": "Email or Password NOT FOUND!!!!!"
}
status : 400 (Bad Request)

.

{
"message": "internal server error",
}
status : 500 (INTERNAL SERVER ERROR)

### GET /Question
***
get all question list
#### URL
http://34.87.7.44/question

#### METHOD
GET
#### URL PARAMS
none
#### data
none
#### headers
token : ''
#### Succes Response
[
{
title : "string",
description : "",
voter : [],
votes : 0,
tags : [],
Answer : [],
User : {
"_id": "5d8067d979d2453f9d4e08b6",
"username": "ando5",
"password": "$2a$10$FKUNaNVmJrEfMia3usm4.uiP7eu61vaqZ9pShy.5g1UUnTR..vNie",
"email": "[email protected]",
"watchedTag": [
"lol",
"",
]
"__v": 0
}
}
]
#### Error Response


{
"message": "anda tidak memilik akses"
}
status : 403 (Forbidden)

.

{
"message": "internal server error",
}
status : 500 (INTERNAL SERVER ERROR)

### POST Question
***
Create New Question
#### URL
http://34.87.7.44/question

#### METHOD
POST
#### URL PARAMS
none
#### data
{
title : String,
description : String,
tags : Array
}
#### headers
token : ''
#### Succes Response
{
title : "string",
description : "",
voter : [],
votes : 0,
tags : [],
Answer : [],
User : {
"_id": "5d8067d979d2453f9d4e08b6",
"username": "ando5",
"password": "$2a$10$FKUNaNVmJrEfMia3usm4.uiP7eu61vaqZ9pShy.5g1UUnTR..vNie",
"email": "[email protected]",
"watchedTag": [
"lol",
"",
]
"__v": 0
}
}
#### Error Response


{
"message": "anda tidak memilik akses"
}
status : 403 (Forbidden)

.

{
"message": "internal server error",
}
status : 500 (INTERNAL SERVER ERROR)


### PUT/ Question
***
get all question list
#### URL
http://34.87.7.44/question/:id

#### METHOD
PUT
#### URL PARAMS
none
#### data
none
#### headers
token : ''
#### Succes Response
<Message Sukses>
#### Error Response
{
"message": "anda tidak memilik akses"
}
status : 403 (Forbidden)

.

{
"message": "internal server error",
}
status : 500 (INTERNAL SERVER ERROR)

### DELETE / Question
***
delete a question
#### URL
http://34.87.7.44/question/:id

#### METHOD
DELETE
#### URL PARAMS
none
#### data
none
#### headers
token : ''
#### Succes Response
<Message Sukses>
#### Error Response


{
"message": "anda tidak memilik akses"
}
status : 403 (Forbidden)

.

{
"message": "internal server error",
}
status : 500 (INTERNAL SERVER ERROR)


### GET Answer
***
get answer by question
#### URL
http://34.87.7.44/answer/:id

#### METHOD
GET
#### URL PARAMS
id Question (params)
#### data
none
#### headers
token : ''
#### Succes Response
[
{
title : "string",
description : "",
voter : [],
votes : 0,
tags : [],
question : [],
User : {
"_id": "5d8067d979d2453f9d4e08b6",
"username": "ando5",
"password": "$2a$10$FKUNaNVmJrEfMia3usm4.uiP7eu61vaqZ9pShy.5g1UUnTR..vNie",
"email": "[email protected]",
"watchedTag": [
"lol",
"",
]
"__v": 0
}
}
]
#### Error Response


{
"message": "anda tidak memilik akses"
}
status : 403 (Forbidden)

.

{
"message": "internal server error",
}
status : 500 (INTERNAL SERVER ERROR)

### POST/ Answer
***
Create New Question
#### URL
http://34.87.7.44/answer

#### METHOD
PUT
#### URL PARAMS
none
#### data
{
question2 : String,
title : String,
description : String
}
#### headers
token : ''
#### Succes Response
[
{
title : "string",
description : "",
voter : [],
votes : 0,
tags : [],
question : [],
User : {
"_id": "5d8067d979d2453f9d4e08b6",
"username": "ando5",
"password": "$2a$10$FKUNaNVmJrEfMia3usm4.uiP7eu61vaqZ9pShy.5g1UUnTR..vNie",
"email": "[email protected]",
"watchedTag": [
"lol",
"",
]
"__v": 0
}
}
]
#### Error Response


{
"message": "anda tidak memilik akses"
}
status : 403 (Forbidden)

.

{
"message": "internal server error",
}
status : 500 (INTERNAL SERVER ERROR)







2 changes: 2 additions & 0 deletions client/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> 1%
last 2 versions
5 changes: 5 additions & 0 deletions client/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
1 change: 1 addition & 0 deletions client/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VUE_APP_SERVER=3000
Loading