A lightweight C++ web server using the CROW framework. Designed for IoT data collection via HTTP/S with the server running on a small device like Raspberry Pi.
- Receives JSON data via HTTP POST at
/post_data - Stores device and brew data in persistent files
- REST API for querying and updating device and brew status
- Web-based UI for device and brew management at
/internal - Dynamic device creation and editing
- Unique log files per device/brew/type
- Open a terminal and navigate to the
cppserver-websitedirectory:cd cppserver-website - Build the project:
mkdir build && cd build cmake .. make
- Run the server:
./cppserver
Send a POST request with JSON data to http://<device-ip>:8080/post_data (or the port you set with the PORT environment variable).
Example using curl:
curl -X POST -H "Content-Type: application/json" -d '{"deviceID":1,"deviceName":"iSpindle1","temperature":22.5,"gravity":1.012}' http://localhost:8080/post_dataOpen your browser and go to:
http://localhost:8080/internal
This UI lets you:
- Create new brews
- View all brews and devices
- (Extendable) Edit devices and brews
| Endpoint | Method | Description |
|---|---|---|
/internal |
GET | Serves the web UI |
/api/brews |
GET | Get all brews (JSON) |
/api/brews |
POST | Create a new brew (JSON) |
/api/devices |
GET | Get all devices (JSON) |
/api/devices/<id> |
PUT | Edit a device (JSON) |
Set your device to POST JSON to:
- Server address/URL:
http://<device-ip> - PORT:
8080(or your configured port) - Endpoint:
/post_data - API/Token: Leave blank (no API keys yet)
- Add more fields to the UI or API as needed
- Add authentication for security
- Add analytics/dashboard features