mirror of
https://github.com/Xevion/linkpulse.git
synced 2025-12-06 03:15:35 -06:00
Separate into /backend and /frontend folders
This commit is contained in:
18
README.md
18
README.md
@@ -4,6 +4,11 @@ This is an empty project right now. It merely holds a simplistic FastAPI server
|
|||||||
|
|
||||||
- Windows WSL is recommended for development. See [here][wsl] for setup instructions.
|
- Windows WSL is recommended for development. See [here][wsl] for setup instructions.
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
- `/backend` A backend server using [FastAPI][fastapi], managed with [Poetry][poetry].
|
||||||
|
- `/frontend` A frontend server using [React][react], managed with [pnpm][pnpm].
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
1. Install [`pyenv`][pyenv] or [`pyenv-win`][pyenv-win]
|
1. Install [`pyenv`][pyenv] or [`pyenv-win`][pyenv-win]
|
||||||
@@ -15,9 +20,20 @@ This is an empty project right now. It merely holds a simplistic FastAPI server
|
|||||||
- Requires `pipx`, see [here][pipx]
|
- Requires `pipx`, see [here][pipx]
|
||||||
- Install with `pipx install poetry`
|
- Install with `pipx install poetry`
|
||||||
|
|
||||||
3. Install backend dependencies - `poetry install`
|
3. Install backend dependencies with `poetry install`
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
- A fully editable (frontend and backend), automatically reloading project is possible, but it requires two terminals.
|
||||||
|
- Each terminal must start in the respective directory (`/backend` and `/frontend`).
|
||||||
|
- `./run.sh` will start the development server in the respective directory.
|
||||||
|
- The first argument is optional, but can be used in the frontend to compile & serve the backend.
|
||||||
|
|
||||||
|
|
||||||
|
[fastapi]: https://fastapi.tiangolo.com/
|
||||||
|
[poetry]: https://python-poetry.org/
|
||||||
|
[react]: https://react.dev/
|
||||||
|
[pnpm]: https://pnpm.io/
|
||||||
[wsl]: https://docs.microsoft.com/en-us/windows/wsl/install
|
[wsl]: https://docs.microsoft.com/en-us/windows/wsl/install
|
||||||
[pipx]: https://pipx.pypa.io/stable/installation/
|
[pipx]: https://pipx.pypa.io/stable/installation/
|
||||||
[pyenv]: https://github.com/pyenv/pyenv
|
[pyenv]: https://github.com/pyenv/pyenv
|
||||||
|
|||||||
1
backend/.python-version
Normal file
1
backend/.python-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.12
|
||||||
@@ -9,3 +9,11 @@ async def get_current_time(request: Request):
|
|||||||
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
user_ip = request.headers.get("X-Forwarded-For")
|
user_ip = request.headers.get("X-Forwarded-For")
|
||||||
return {"time": current_time, "ip": user_ip}
|
return {"time": current_time, "ip": user_ip}
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import asyncio
|
||||||
|
from hypercorn.config import Config
|
||||||
|
from hypercorn.asyncio import serve
|
||||||
|
|
||||||
|
asyncio.run(serve(app, Config()))
|
||||||
0
poetry.lock → backend/poetry.lock
generated
0
poetry.lock → backend/poetry.lock
generated
@@ -8,7 +8,7 @@ readme = "README.md"
|
|||||||
package-mode = false
|
package-mode = false
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
start = "linkpulse.main:app"
|
start = "linkpulse.main"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.12"
|
python = "^3.12"
|
||||||
0
backend/run.sh
Normal file
0
backend/run.sh
Normal file
Reference in New Issue
Block a user