Finish database, API, Compare/Detail/Compare Views

This commit is contained in:
swangnice
2025-08-02 21:05:35 +08:00
parent 91a010662d
commit 916e5386c5
25 changed files with 2196 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
# A Personal MCU Benchmark
This is a personal project to benchmark various MCUs (Microcontroller Units) using FastAPI and SQLite for the backend and Vue.js for the frontend. The project allows you to add, list, and compare different MCUs.
```
mcubenchmark/
├── backend/
│ ├── main.py # FastAPI 主入口
│ ├── database.py # SQLite Base operations
│ ├── admin.py # SQLite CURD
│ └── mcu.db
├── frontend/
│ ├── public/
│ ├── src/
│ │ ├── views/
│ │ │ ├── ListView.vue
│ │ │ └── CompareView.vue
│ │ ├── App.vue
│ │ └── main.js
├── README.md
└── requirements.txt
```
## How to use?
Clone this repo, and install the requirements:
```bash
cd mcu-benchmark
conda create -n mcu-benchmark
conda activate mcu-benchmark
pip install -r requirements.txt
```
Then, start the backend server:
```bash
cd backend
uvicorn main:app --host 0.0.0.0 --port 3010 --reload
```
Use `admin.py` and follow the instructions to add MCUs to the database:
```
python admin.py
```
Now, you can access the backend API at `http://localhost:3010/api/mcus`.
Run the frontend (before this step, you need to install Node.js, npm and other dependencies):
```bash
cd backend
npm run dev
```
Now, you can access the frontend at `http://localhost:<port>`. The default port of Vite is `5173`.