- Docker and Docker Compose
The easiest way to start the application is to use Docker Compose:
./init.shThis script will:
- Build and start the PostgreSQL and application containers
- Wait for the services to be ready
- Display information about how to access the API
Alternatively, you can run Docker Compose directly:
docker-compose up -dThe API will be available at http://localhost:8080
If you prefer to run the application without Docker:
- Start the PostgreSQL database:
docker-compose up -d postgres- Build and run the application:
go build -o smarthome
./smarthomeA Postman collection is provided for testing the API. Import the smarthome-api.postman_collection.json file into Postman to get started.
GET /health- Health checkGET /api/v1/sensors- Get all sensorsGET /api/v1/sensors/:id- Get a specific sensorPOST /api/v1/sensors- Create a new sensorPUT /api/v1/sensors/:id- Update a sensorDELETE /api/v1/sensors/:id- Delete a sensorPATCH /api/v1/sensors/:id/value- Update a sensor's value and status