Skip to content

TeemuTallskog/ReactProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.
You may also see any lint errors in the console.

npm test

Launches the test runner for REST api tests.

Configuring database

create a database:

CREATE DATABASE database_name

add tables for the database: Script for creating database tables;

Required environment variables:

TOKEN_KEY = "json webtoken key"
DB_NAME = "database_name"
DB_USERNAME = "username"
DB_PASSWORD = "password"

Introduction

Dark Mode Light mode
user search user search

Signup page

a signup page

Login page

a login page

Home page

home page

Profile page

a profile page

Editing profile

edit profile

User search

user search

REST api description

End pointHTTP MethodDescriptionParametersResponse
/signupPOSTUsed for creating an account
{
    "username": "",
    "email": "",
    "password": ""
}
{
    "accessToken": "",
    "username": "",
    "user_id": ""
}
/loginPOSTUsed for logging in and receiving a jsonwebtoken
{
    "email": "",
    "password": ""
}
{
    "accessToken": "",
    "username": "",
    "user_id": ""
}
/post?post_id=GETUsed for retrieving a single post Header: authorization
Query: post_id
{
    "post": {
      "user_id":  "",
      "post_id":  "",
      "content":  "",
      "reply_to":  "",
      "created":  "",
      "username":  "",
      "profile_img": "",
      "total_likes":  "",
      "user_like_status":  "",
      "reply_count": ""
    }
}
/postPOSTUsed for creating a new post Header: authorization
Body:
{
    "content": "",
    "reply_to": ""
}
/delete/post?post_id=DELETEUsed to delete posts Header: authorization
Query: post_id
/postsGETUsed for retrieving posts from followed users for homepage Header: authorization
{
    "posts": [
      {
        "user_id":  "",
        "post_id":  "",
        "content":  "",
        "reply_to":  "",
        "created":  "",
        "username":  "",
        "profile_img": "",
        "total_likes":  "",
        "user_like_status":  "",
        "reply_count": ""
      }
    ]
}
/user/posts?username=GETUsed for retrieving posts from followed users for homepage Header: authorization
Query: post_id
{
    "posts": [
      {
        "user_id":  "",
        "post_id":  "",
        "content":  "",
        "reply_to":  "",
        "created":  "",
        "username":  "",
        "profile_img": "",
        "total_likes":  "",
        "user_like_status":  "",
        "reply_count": ""
      }
    ]
}
/replies?post_id=GETUsed for retrieving replies for a post Header: authorization
Query: post_id
{
    "posts": [
      {
        "user_id":  "",
        "post_id":  "",
        "content":  "",
        "reply_to":  "",
        "created":  "",
        "username":  "",
        "profile_img": "",
        "total_likes":  "",
        "user_like_status":  "",
        "reply_count": ""
      }
    ]
}
/users?username=GETRetrieves users matching search parameter Header: authorization
Query: username
{
    "users": [
      {
        "user_id":  "",
        "username":  "",
        "profile_img": "",
        "user_follow_status":  ""
      }
    ]
}
/likePOSTUsed to like a post Header: authorization
Body:
{
  "post_id":  ""
}
{
  "total_likes":  "",
  "user_like_status":  ""
}
/account?username=GETUsed to load profile data of a single user Header: authorization
Query: username
{
  "following":  "",
  "followers":  "",
  "posts":  "",
  "isFollowing":  "",
  "user": {
    "username": "",
    "bio": "",
    "profile_img":  "",
    "user_id": ""
  }
}
/user/followers?username=GETUsed to load followers of a user Header: authorization
Query: username
{
  "followers": [
      {
        "username": "",
        "profile_img":  "",
        "user_id": "",
        "user_follow_status": ""
      }
    ]
}
/user/follows?username=GETUsed to load users that an account follows Header: authorization
Query: username
{
  "follows": [
      {
        "username": "",
        "profile_img":  "",
        "user_id": "",
        "user_follow_status": ""
      }
    ]
}
/user/followPOSTUsed to follow or to unfollow a user Header: authorization
Body:
{
  "user_id": "",
  "follow": "true/false"
}
{
  "user_like_status": ""
}
/profile_imgGETUsed to get the profile image address of the logged in user Header: authorization
{
  "profile_img": "URL"
}
/upload/profile_imgPOSTUsed to upload a profile image Header: authorization
Body:
{
  "image": "base64 image"
}
/images?url=GETUsed to retrieve images from the server Query: url(filename) File: image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors