Skip to content

irklva/posts-exercise-react

This branch is 33 commits ahead of InitechSoftware/react-practical-assignment:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jul 3, 2023
1e6b911 · Jul 3, 2023

History

35 Commits
May 6, 2023
Jul 3, 2023
May 15, 2023
Jan 19, 2022
Jul 24, 2022
May 11, 2023
May 11, 2023

Repository files navigation

Structure: This project conatains two application:

  • server app (inside of './server' folder)
  • client app (inside of './client' folder)

Task related to client app. So, everything what you have to do you will do it inside of './client' folder

Steps:

  1. Download and install node here - https://nodejs.org/en/ (if needed)
  2. Open project using VSC or some other code editor
  3. Run command in terminal (inside of this folder): npm run setup (it should install all dependencies)
  4. Run commant in terminal (inside of this folder): npm run start_server (it should start server app)
  5. Open additional terminal and run command: npm run start_client (it should start client app)

API Client app should use api provided by server app. Here is endpoints description:

MAIN_URL = http://localhost:8080/

CREATE POST: url: MAIN_URL + 'post/' method: post body: { title: , username: } response: { id: , title: , username: likes: <Array> //usernames dislikes: <Array> //usernames imageSrc: //path date: , comments: <Array> }

UPDATE POST url: MAIN_URL + 'post/{id}' method: put body: { title?: , likes?: Array<>, dislikes?: Array<> } response: { id: , title: , username: likes: <Array> dislikes: <Array> date: , comments: <Array> }

FILTER/SEARCH POSTS BY KEYWORD url MAIN_URL + 'post/search/${keyWord}' method: get response: [ { id: , title: , username: likes: <Array> //usernames dislikes: <Array> //usernames imageSrc: //path date: , comments: <Array> } ... ]

GET POSTS BY PAGES (9 posts per page) url MAIN_URL + 'post/page/${pageNumber}' // pageNumber > 0 response: [ { id: , title: , username: likes: <Array> //usernames dislikes: <Array> //usernames imageSrc: //path date: , comments: <Array> } ... ]

  • response conains additional information: totalPages, total and page

DELETE POST url: MAIN_URL + 'post/{id}' method: delete response: { id: , title: , username: likes: <Array> //usernames dislikes: <Array> //usernames imageSrc: //path date: , comments: <Array> }

UPLOAD POST PICTURE url: MAIN_URL + 'post/{id}/picture' method: post body: FormData // should contain file like this formData.append("picture", file); response: { id: , title: , username: likes: <Array> //usernames dislikes: <Array> //usernames imageSrc: //path date: , comments: <Array> }

CREATE COMMENT url: MAIN_URL + 'comment' method: post body: { text: , postId: , username: , } response: { id: , text: , postId: , username: , likes: <Array>, dislikes: <Array>, date: }

UPDATE COMMENT url: MAIN_URL + 'comment/{id}' method: put body: { text: , likes: <Array>, dislikes: <Array>, } response: { id: , text: , postId: , username: , likes: <Array>, dislikes: <Array>, date: }

DELETE COMMENT url: MAIN_URL + 'comment/{id}' method: delete response: { id: , text: , postId: , username: , likes: <Array>, dislikes: <Array>, date: }

=============== i hope next endpoints will shouldn't be used, but i'll left it here, just in case ====================

GET ALL POSTS url: MAIN_URL + 'post' method: get response: [ { id: , title: , username: likes: <Array> //usernames dislikes: <Array> //usernames imageSrc: //path date: , comments: <Array> } ... ]

GET POST url: MAIN_URL + 'post/{id}' method: get response: { id: , title: , username: likes: <Array> //usernames dislikes: <Array> //usernames imageSrc: //path date: , comments: <Array> }

GET COMMENT url: MAIN_URL + 'comment/{id}' method: get response: { id: , text: , postId: , username: , likes: <Array>, dislikes: <Array>, date: }

GET COMMENTS url: MAIN_URL + 'comment' method: get response: [ { id: , text: , postId: , username: , likes: <Array>, dislikes: <Array>, date: }, ... ]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 91.7%
  • CSS 6.2%
  • HTML 2.1%