Skip to content

banana-splits/FaceSpace-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FaceSpace

Links

Planning Story

As a team we planned on working on a specific functionality each. Keeping track using a trello board. Problem solving issues were solved as a team whenever they arose.

User Stories

As an unregistered user, I would like to sign up with email and password.
As a registered user, I would like to sign in with email and password.
As a signed in user, I would like to change password.
As a signed in user, I would like to sign out.
As a signed in user, I would like to add a post to my wall.
As a signed in user, I would like to update a post on my wall.
As a signed in user, I would like to delete a post on my wall.
As a signed in user, I would like to see all my posts.
As a signed in user, I would like to view a list of other users and view their walls.

Technologies Used

  • Node
  • Express
  • MongoDB
  • Mongoose
  • JavaScript

Wireframes

FaceSpace Wireframes

ERD

FaceSpace ERD

Logo

FaceSpace Logo

Routes

Authentication

Verb URI Pattern Controller#Action
POST /sign-up users#signup
POST /sign-in users#signin
PATCH /change-password/ users#changepw
DELETE /sign-out/ users#signout

POST /sign-up

Request:

curl --include --request POST https://mcdennis-post-board.herokuapp.com/sign-up \
  --header "Content-Type: application/json" \
  --data '{
    "credentials": {
      "email": "an@example.email",
      "password": "an example password",
      "password_confirmation": "an example password"
    }
  }'
curl-scripts/sign-up.sh

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
  "user": {
    "id": 1,
    "email": "an@example.email"
  }
}

POST /sign-in

Request:

curl --include --request POST https://mcdennis-post-board.herokuapp.com/sign-in \
  --header "Content-Type: application/json" \
  --data '{
    "credentials": {
      "email": "an@example.email",
      "password": "an example password"
    }
  }'
curl-scripts/sign-in.sh

Response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "user": {
    "id": 1,
    "email": "an@example.email",
    "token": "33ad6372f795694b333ec5f329ebeaaa"
  }
}

PATCH /change-password/

Request:

curl --include --request PATCH https://mcdennis-post-board.herokuapp.com/change-password/ \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "passwords": {
      "old": "an example password",
      "new": "super sekrit"
    }
  }'
TOKEN=33ad6372f795694b333ec5f329ebeaaa curl-scripts/change-password.sh

Response:

HTTP/1.1 204 No Content

DELETE /sign-out/

Request:

curl --include --request DELETE https://mcdennis-post-board.herokuapp.com/sign-out/ \
  --header "Authorization: Bearer $TOKEN"
TOKEN=33ad6372f795694b333ec5f329ebeaaa curl-scripts/sign-out.sh

Response:

HTTP/1.1 204 No Content

Posts

Verb URI Pattern Controller#Action
POST /posts users#Create Post
GET /posts users#View All Posts
GET /users/:userId users#View Posts By One User
GET /posts/:postId users#View One Post
PATCH /posts/:id users#Update Post
DELETE /posts/:id users#Destroy Post

POST /posts

Request:

curl "https://rocky-beach-46261.herokuapp.com" \
  --include \
  --request POST \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer $TOKEN" \
  --data '{
    "post": {
      "text": "Text Of The Post"
    }
  }'
TOKEN=33ad6372f795694b333ec5f329ebeaaa curl-scripts/posts/create.sh

Response:

TP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{"post":
  {
    "_id":"60988d0f7e39ba00153ea5d6",
    "text":"Text Of The Post",
    "owner":"60988ca97e39ba00153ea5d5",
    "ownerEmail":"an@example.email",
    "comments":[],
    "createdAt":"2021-05-10T01:31:59.280Z",
    "updatedAt":"2021-05-10T01:31:59.280Z",
    "__v":0
  }
}

GET /posts

Request:

curl "https://rocky-beach-46261.herokuapp.com" \
  --include \
  --request GET
  --header "Authorization: Bearer $TOKEN"
TOKEN=33ad6372f795694b333ec5f329ebeaaa curl-scripts/posts/index.sh

Response:

TP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{"posts":
  [
    {
      "_id":"609bdcd2c23acd1c3c28ac8c",
      "text":"r",
      "owner":"60997e719523eb36eca8bce9",
      "ownerEmail":"cat@dog",
      "comments":[],
      "createdAt":"2021-05-12T13:49:06.426Z",
      "updatedAt":"2021-05-12T13:49:06.426Z",
      "__v":0
    },
    {
      "_id":"609bdcd8c23acd1c3c28ac8d",
      "text":"t",
      "owner":"60997e719523eb36eca7c9b1",
      "ownerEmail":"user@email",
      "comments":[],
      "createdAt":"2021-05-12T13:49:12.278Z",
      "updatedAt":"2021-05-12T13:49:12.278Z",
      "__v":0
    }
  ]
}

GET /users/:userId

Request:

curl "https://rocky-beach-46261.herokuapp.com/users/$USER_ID" \
  --include \
  --request GET
  --header "Authorization: Bearer $TOKEN"
TOKEN=33ad6372f795694b333ec5f329ebeaaa USER_ID=609be624c23acd1c3c28ac8f curl-scripts/users/show.sh

Response:

TP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{"posts":
  {
    [
      {
        "_id":"609be62bc23acd1c3c28ac90",
        "text":"hi",
        "owner":"609be624c23acd1c3c28ac8f",
        "ownerEmail":"blue@green",
        "comments":[],
        "createdAt":"2021-05-12T14:28:59.115Z",
        "updatedAt":"2021-05-12T14:28:59.115Z",
        "__v":0
      },
      {
        "_id":"609be62ec23acd1c3c28ac91",
        "text":"hello",
        "owner":"609be624c23acd1c3c28ac8f",
        "ownerEmail":"blue@green",
        "comments":[],
        "createdAt":"2021-05-12T14:29:02.857Z",
        "updatedAt":"2021-05-12T14:29:02.857Z",
        "__v":0
      }
    ]
  }
}

GET /posts/:postId

Request:

curl "https://rocky-beach-46261.herokuapp.com/$POST_ID" \
  --include \
  --request GET
  --header "Authorization: Bearer $TOKEN"
TOKEN=33ad6372f795694b333ec5f329ebeaaa POST_ID=609be62ec23acd1c3c28ac91 curl-scripts/posts/show.sh

Response:

TP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "post":{
    "_id":"609be62ec23acd1c3c28ac91",
    "text":"hello",
    "owner":"609be624c23acd1c3c28ac8f",
    "ownerEmail":"blue@green",
    "comments":[],
    "createdAt":"2021-05-12T14:29:02.857Z",
    "updatedAt":"2021-05-12T14:29:02.857Z",
    "__v":0
  }
}

PATCH /posts/:postId

Request:

curl "https://rocky-beach-46261.herokuapp.com/$POST_ID" \
  --include \
  --request PATCH \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer $TOKEN" \
  --data '{
      "post": {
        "text": "New Text"
      }
    }'
TOKEN=33ad6372f795694b333ec5f329ebeaaa POST_ID=609be62ec23acd1c3c28ac91 curl-scripts/posts/update.sh

Response:

TP/1.1 204 No Content

DELETE /posts/:id

Request:

curl "https://rocky-beach-46261.herokuapp.com/$POST_ID" \
  --include \
  --request DELETE
  --header "Authorization: Bearer $TOKEN"
TOKEN=33ad6372f795694b333ec5f329ebeaaa POST_ID=609be62ec23acd1c3c28ac91 curl-scripts/posts/destroy.sh

Response:

TP/1.1 204 No Content
  1. All content is licensed under a CC­BY­NC­SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact legal@ga.co.

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •