diff --git a/frontend/app/.gitignore b/frontend/app/.gitignore new file mode 100644 index 0000000..4d29575 --- /dev/null +++ b/frontend/app/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/frontend/app/package.json b/frontend/app/package.json new file mode 100644 index 0000000..9c11af8 --- /dev/null +++ b/frontend/app/package.json @@ -0,0 +1,40 @@ +{ + "name": "forum", + "version": "0.1.0", + "private": true, + "dependencies": { + "@testing-library/jest-dom": "^5.17.0", + "@testing-library/react": "^13.4.0", + "@testing-library/user-event": "^13.5.0", + "axios": "^1.6.8", + "bulma": "^1.0.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-scripts": "5.0.1", + "web-vitals": "^2.1.4" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/frontend/app/src/App.js b/frontend/app/src/App.js new file mode 100644 index 0000000..45f7602 --- /dev/null +++ b/frontend/app/src/App.js @@ -0,0 +1,41 @@ +import 'bulma/css/bulma.css' +import {useEffect, useState} from "react"; +import axios from "axios"; +import PostList from "./components/Post/PostList"; + +function App() { + const [postList, setPostsList] = useState([]); + + const fetchPosts = async () => { + await axios.get("http://localhost:8000/catalog") + .then((response) => { setPostsList(response.data)}) + } + + useEffect(() => { + fetchPosts(); + }, []); + + async function handleClickRefresh() { + await fetchPosts(); + } + + return ( + <> +
Singleboard Forum App
+{content}
+0 replies
+