Skip to content

Commit bc01da6

Browse files
committed
init
0 parents  commit bc01da6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+16065
-0
lines changed

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/client/node_modules
5+
/server/node_modules
6+
/node_modules
7+
/client/.pnp
8+
/client/.pnp.js
9+
10+
# testing
11+
/client/coverage
12+
13+
# production
14+
/client/build
15+
16+
# misc
17+
/client/.DS_Store
18+
/client/.env.local
19+
/client/.env.development.local
20+
/client/.env.test.local
21+
/client/.env.production.local
22+
23+
/client/npm-debug.log*
24+
/client/yarn-debug.log*
25+
/client/yarn-error.log*
26+
/client/.idea
27+
/server/.idea

README.md

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
Structure:
2+
This project conatains two application:
3+
- server app (inside of './server' folder)
4+
- client app (inside of './client' folder)
5+
6+
Task related to client app. So, everything what you have to do you will do it inside of './client' folder
7+
8+
Steps:
9+
1. Download and install node here - https://nodejs.org/en/ (if needed)
10+
2. Open project using VSC or some other code editor
11+
3. Run command in terminal (inside of this folder): npm run setup (it should install all dependencies)
12+
4. Run commant in terminal (inside of this folder): npm run start_server (it should start server app)
13+
5. Open additional terminal and run command: npm run start_client (it should start client app)
14+
15+
API
16+
Client app should use api provided by server app.
17+
Here is endpoints description:
18+
19+
MAIN_URL = http://localhost:8080/
20+
21+
CREATE POST:
22+
url: MAIN_URL + 'post/'
23+
method: post
24+
body: {
25+
title: <string>,
26+
username: <string>
27+
}
28+
response: {
29+
id: <number>,
30+
title: <string>,
31+
username: <string>
32+
likes: <Array<string>> //usernames
33+
dislikes: <Array<string>> //usernames
34+
imageSrc: <string> //path
35+
date: <number>,
36+
comments: <Array<Comment>>
37+
}
38+
39+
UPDATE POST
40+
url: MAIN_URL + 'post/{id}'
41+
method: put
42+
body: {
43+
title?: <string>,
44+
likes?: Array<<string>>,
45+
dislikes?: Array<<strings>>
46+
}
47+
response: {
48+
id: <number>,
49+
title: <string>,
50+
username: <string>
51+
likes: <Array<string>>
52+
dislikes: <Array<string>>
53+
date: <number>,
54+
comments: <Array<Comment>>
55+
}
56+
57+
FILTER/SEARCH POSTS BY KEYWORD
58+
url MAIN_URL + 'post/search/${keyWord}'
59+
method: get
60+
response: [
61+
{
62+
id: <number>,
63+
title: <string>,
64+
username: <string>
65+
likes: <Array<string>> //usernames
66+
dislikes: <Array<string>> //usernames
67+
imageSrc: <string> //path
68+
date: <number>,
69+
comments: <Array<Comment>>
70+
}
71+
...
72+
]
73+
74+
GET POSTS BY PAGES (9 posts per page)
75+
url MAIN_URL + '/page/${pageNumber}' // pageNumber > 0
76+
response: [
77+
{
78+
id: <number>,
79+
title: <string>,
80+
username: <string>
81+
likes: <Array<string>> //usernames
82+
dislikes: <Array<string>> //usernames
83+
imageSrc: <string> //path
84+
date: <number>,
85+
comments: <Array<Comment>>
86+
}
87+
...
88+
]
89+
+ response conains additional information: totalPages, total and page
90+
91+
DELETE POST
92+
url: MAIN_URL + 'post/{id}'
93+
method: delete
94+
response: {
95+
id: <number>,
96+
title: <string>,
97+
username: <string>
98+
likes: <Array<string>> //usernames
99+
dislikes: <Array<string>> //usernames
100+
imageSrc: <string> //path
101+
date: <number>,
102+
comments: <Array<Comment>>
103+
}
104+
105+
UPLOAD POST PICTURE
106+
url: MAIN_URL + 'post/{id}/picture'
107+
method: post
108+
body: FormData // should contain file like this formData.append("picture", file);
109+
response: {
110+
id: <number>,
111+
title: <string>,
112+
username: <string>
113+
likes: <Array<string>> //usernames
114+
dislikes: <Array<string>> //usernames
115+
imageSrc: <string> //path
116+
date: <number>,
117+
comments: <Array<Comment>>
118+
}
119+
120+
CREATE COMMENT
121+
url: MAIN_URL + 'comment'
122+
method: post
123+
body: {
124+
text: <string>,
125+
postId: <number>,
126+
username: <string>,
127+
}
128+
response: {
129+
id: <number>,
130+
text: <string>,
131+
postId: <number>,
132+
username: <string>,
133+
likes: <Array<strings>>,
134+
dislikes: <Array<strings>>,
135+
date: <number>
136+
}
137+
138+
UPDATE COMMENT
139+
url: MAIN_URL + 'comment/{id}'
140+
method: put
141+
body: {
142+
text: <string>,
143+
likes: <Array<strings>>,
144+
dislikes: <Array<strings>>,
145+
}
146+
response: {
147+
id: <number>,
148+
text: <string>,
149+
postId: <number>,
150+
username: <string>,
151+
likes: <Array<strings>>,
152+
dislikes: <Array<strings>>,
153+
date: <number>
154+
}
155+
156+
DELETE COMMENT
157+
url: MAIN_URL + 'comment/{id}'
158+
method: delete
159+
response: {
160+
id: <number>,
161+
text: <string>,
162+
postId: <number>,
163+
username: <string>,
164+
likes: <Array<strings>>,
165+
dislikes: <Array<strings>>,
166+
date: <number>
167+
}
168+
169+
170+
=============== i hope next endpoints will shouldn't be used, but i'll left it here, just in case ====================
171+
172+
GET ALL POSTS
173+
url: MAIN_URL + 'post'
174+
method: get
175+
response: [
176+
{
177+
id: <number>,
178+
title: <string>,
179+
username: <string>
180+
likes: <Array<string>> //usernames
181+
dislikes: <Array<string>> //usernames
182+
imageSrc: <string> //path
183+
date: <number>,
184+
comments: <Array<Comment>>
185+
}
186+
...
187+
]
188+
189+
GET POST
190+
url: MAIN_URL + 'post/{id}'
191+
method: get
192+
response: {
193+
id: <number>,
194+
title: <string>,
195+
username: <string>
196+
likes: <Array<string>> //usernames
197+
dislikes: <Array<string>> //usernames
198+
imageSrc: <string> //path
199+
date: <number>,
200+
comments: <Array<Comment>>
201+
}
202+
203+
GET COMMENT
204+
url: MAIN_URL + 'comment/{id}'
205+
method: get
206+
response: {
207+
id: <number>,
208+
text: <string>,
209+
postId: <number>,
210+
username: <string>,
211+
likes: <Array<strings>>,
212+
dislikes: <Array<strings>>,
213+
date: <number>
214+
}
215+
216+
GET COMMENTS
217+
url: MAIN_URL + 'comment'
218+
method: get
219+
response: [
220+
{
221+
id: <number>,
222+
text: <string>,
223+
postId: <number>,
224+
username: <string>,
225+
likes: <Array<strings>>,
226+
dislikes: <Array<strings>>,
227+
date: <number>
228+
},
229+
...
230+
]

client/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Getting Started with Create React App
2+
3+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4+
5+
## Available Scripts
6+
7+
In the project directory, you can run:
8+
9+
### `npm start`
10+
11+
Runs the app in the development mode.\
12+
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13+
14+
The page will reload when you make changes.\
15+
You may also see any lint errors in the console.
16+
17+
### `npm test`
18+
19+
Launches the test runner in the interactive watch mode.\
20+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21+
22+
### `npm run build`
23+
24+
Builds the app for production to the `build` folder.\
25+
It correctly bundles React in production mode and optimizes the build for the best performance.
26+
27+
The build is minified and the filenames include the hashes.\
28+
Your app is ready to be deployed!
29+
30+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31+
32+
### `npm run eject`
33+
34+
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
35+
36+
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37+
38+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39+
40+
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41+
42+
## Learn More
43+
44+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45+
46+
To learn React, check out the [React documentation](https://reactjs.org/).
47+
48+
### Code Splitting
49+
50+
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51+
52+
### Analyzing the Bundle Size
53+
54+
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55+
56+
### Making a Progressive Web App
57+
58+
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59+
60+
### Advanced Configuration
61+
62+
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63+
64+
### Deployment
65+
66+
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67+
68+
### `npm run build` fails to minify
69+
70+
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

0 commit comments

Comments
 (0)