Skip to content

awattsup/cppserver-website

Repository files navigation

cppserver-website

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.

Features

  • 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

Build Instructions

  1. Open a terminal and navigate to the cppserver-website directory:
    cd cppserver-website
  2. Build the project:
    mkdir build && cd build
    cmake ..
    make
  3. Run the server:
    ./cppserver

Usage

Sending Device Data

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_data

Web UI

Open 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

REST API Endpoints

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)

Configuring your IoT Device

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)

Extending

  • Add more fields to the UI or API as needed
  • Add authentication for security
  • Add analytics/dashboard features

About

A C++ webserver for getting data from IoT brew monitoring devices, and running a website.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages