Compare commits

...

10 Commits

Author SHA1 Message Date
d789f9eafd remove unused nginx config 2024-04-12 13:22:12 -04:00
d1a6b17920 update README.md 2024-04-09 18:02:32 -04:00
7cf8cef8cf update docker compose 2024-04-09 17:53:50 -04:00
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
b0027575b6 Finish merge 2024-04-09 17:43:06 -04:00
e79f2840d7 Merge branch 'dev' of git.juggalol.com:agatha/forum-app into dev 2024-04-06 15:57:53 -04:00
2db6e18d5b feat: add authentication for administration (#2)
Reviewed-on: #2
Co-authored-by: agatha <agatha@juggalol.com>
Co-committed-by: agatha <agatha@juggalol.com>
2024-04-06 19:56:48 +00:00
42ee9326ae chore: remove unused import 2024-04-06 13:33:44 -04:00
5 changed files with 38 additions and 34 deletions

View File

@ -1,6 +1,12 @@
# Forum App with FastAPI
Model is after 4chan
# Singleboard Forum
A 4ch ripoff, coded as an exercise in learning full stack development with React
and FastAPI.
Board: has threads, unique counter for posts
Thread: Collection of related posts
Post: post_id, thread_id, title, content
## Demo
Start the Docker containers:
```
docker compose up -d
```
Interact with the backend API to add some posts by browsing to http://localhost:8000/docs,
then browse to the frontend at http://localhost:3000.

View File

@ -5,7 +5,7 @@ services:
context: ./backend
dockerfile: Dockerfile
ports:
- '8001:8000'
- '8000:8000'
restart: unless-stopped
frontend:
@ -13,7 +13,7 @@ services:
context: ./frontend
dockerfile: Dockerfile
ports:
- '8000:8000'
- '3000:3000'
restart: unless-stopped
depends_on:
- backend
- backend

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)})
}
@ -38,4 +40,4 @@ function App() {
);
}
export default App;
export default App;

View File

@ -1,22 +0,0 @@
events {
worker_connections 1024;
}
http {
server {
listen 8000 default_server;
listen [::]:8000 default_server;
root /app;
index index.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location /api {
proxy_pass http://backend:8000/;
}
}
}