Compare commits

...

3 Commits

Author SHA1 Message Date
1c4fd23e76 update README.md 2024-04-09 17:51:12 -04:00
dc67c7eb10 use variable for api base url 2024-04-09 17:50:06 -04:00
82bd76618c update frontend README.md 2024-04-09 17:47:09 -04:00
2 changed files with 24 additions and 4 deletions

View File

@ -1,4 +1,22 @@
# Forum Frontend
Should be extremely simple to start with no styling.
The frontend for the forum is written in React.
Node.js with a nice framework should be the ultimate goal, but could just do simple HTML and JS by hand for now.
**Note**: Before running, update the `apiUrl` in `app/src/App.js` to point your backend.
## Development
To start the frontend in development mode and serve on http://localhost:3000:
```shell
npm run start
```
## Production
```shell
# Install serve
npm install -g serve
# Build for production
npm run build
# Serve
serve -s --no-clipboard build
```

View File

@ -3,11 +3,13 @@ import {useEffect, useState} from "react";
import axios from "axios";
import PostList from "./components/Post/PostList";
const apiUrl = "http://localhost:8000";
function App() {
const [postList, setPostsList] = useState([]);
const fetchPosts = async () => {
await axios.get("http://localhost:8000/catalog")
await axios.get(apiUrl + "/catalog")
.then((response) => { setPostsList(response.data)})
}