Compare commits
3 Commits
b0027575b6
...
1c4fd23e76
Author | SHA1 | Date | |
---|---|---|---|
1c4fd23e76 | |||
dc67c7eb10 | |||
82bd76618c |
@ -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
|
||||
```
|
||||
|
@ -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)})
|
||||
}
|
||||
|
||||
@ -38,4 +40,4 @@ function App() {
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
export default App;
|
||||
|
Loading…
Reference in New Issue
Block a user