55 lines
1.1 KiB
Markdown
55 lines
1.1 KiB
Markdown
# CxWebApp
|
|
|
|
C++ web application using [Crow](https://crowcpp.org) framework, built with CMake and Xcode.
|
|
|
|
## Prerequisites
|
|
|
|
- macOS with Xcode and command-line tools installed
|
|
- CMake 3.22+ (`brew install cmake`)
|
|
|
|
## Build with Xcode
|
|
|
|
```bash
|
|
# Generate Xcode project
|
|
cmake -B build -G Xcode
|
|
|
|
# Open in Xcode
|
|
open build/CxWebApp.xcodeproj
|
|
```
|
|
|
|
Build and run the `CxWebApp` scheme in Xcode (⌘R).
|
|
|
|
## Build from command line
|
|
|
|
```bash
|
|
cmake -B build
|
|
cmake --build build
|
|
./build/CxWebApp
|
|
```
|
|
|
|
## Usage
|
|
|
|
Open **http://localhost:8080** in your browser.
|
|
|
|
### API Endpoints
|
|
|
|
| Method | Path | Description |
|
|
|--------|------------------|-------------------|
|
|
| GET | `/api/health` | Health check |
|
|
| GET | `/api/items` | List all items |
|
|
| GET | `/api/items/:id` | Get item by ID |
|
|
| POST | `/api/items` | Create item |
|
|
| DELETE | `/api/items/:id` | Delete item |
|
|
|
|
### Example
|
|
|
|
```bash
|
|
# Create
|
|
curl -X POST http://localhost:8080/api/items \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"name":"Test","description":"A test item"}'
|
|
|
|
# List
|
|
curl http://localhost:8080/api/items
|
|
```
|