---
# System prepended metadata

title: Team Configuraion

---

# Team Configuraion
Backend:
earnest
dao yong
Kenisvery

Frontend:
Janessa (login)
Melody (individual post)
Win Soon (home page)

## Backend APIs
http://localhost:5000/

### LOGIN (DONE)
http://localhost:3001/api/v1/Login/
## Sample Json
####### pass
{
    "Name": "Brose McCreery",
    "password": "123"
}
# Fail testcase
{
    "Name": "Test",
    "password": "123"
}


## Result
//Pass
res.status(200).send({ Msg: "Login successfully", Token: token });
{
    "Msg": "Login successfully",
    "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJOYW1lIjoiQnJvc2UgTWNDcmVlcnkiLCJpYXQiOjE2NDI2NjE5OTcsImV4cCI6MTY1NDY2MTk5N30.THiAZaLK2Ipfg-bvegzZN25MlSihnLeC0eJGOs1MAwA"
}
//Fail
res.status(401).send("Login Fail");
## Return all post http://localhost:5000/post
GET REQUEST

    output:
    {
      "posts": [
                {
                  "post_description": "Walking up and down the aisles for what seems like hours.", 
                  "post_id": 1, 
                  "post_image": "https://preview.redd.it/jjvqtw9iapb81.gif?format=mp4&s=e333e78478df813b5b18ecd0905efc8b00ae210c", 
                  "post_title": "Relatable"
                }]
    }

## Insert Post http://localhost:5000/insert_post
    Method = POST
    json needed input
    {
        "post_title":"hello",
        "post_description": "hello",
        "post_image":"https:"
    }
    Output:
    status 201 -> Success
    status 401 -> Failed

## Get all Loggedin post
###### User own post

http://localhost:5000/post/<name>
    Pass name through ^address 
    Example /post/Brose McCreery
    Method = GET
    status 201 -> Success
    status 500 -> Failed
    output

## Update Post
http://localhost:5000/update_post
    Method = POST
    json needed input
    {
        "post_title":"hello",
        "post_description": "hello",
        "post_image":"https:"
    }
    status 201 -> Success
    status 500 -> Failed
    
## Delete Post
http://localhost:5000/delete_post/<name>
    Method = POST
    json needed input
    {
        "post_title":"hello",
        "post_description": "hello",
        "post_image":"https:"
    }
    status 201 -> Success
    status 500 -> Failed

## API CALL SAMPLE
```
const data = {
"Name": name,
"password": password
 }
const response = fetch("http://localhost:3001/api/v1/Login", {
            method: "POST",
            mode:'cors',
            credentials:'same-origin',
            headers: {
                'Content-Type': 'application/json'
              },
              referrerPolicy: 'no-referrer',
            body: JSON.stringify(data),
        })
```
##   Database
    Backend credentials for localhost database username and password
    - Change ormconfig.json
    - Change line 12 of app.py with your own URI
    