initial core commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
# Lambda-IoT Core
|
||||
|
||||
This repository contains a minimal Go REST service used as the backend for the Lambda-IoT project.
|
||||
|
||||
## Features ✅
|
||||
|
||||
- Simple HTTP server with two endpoints:
|
||||
- `GET /health` — basic health check
|
||||
- `GET /hello` — example greeting endpoint
|
||||
- Tests for handlers using `httptest`
|
||||
- Multi-stage `Dockerfile` for small production images
|
||||
- `Makefile` with common tasks (build, run, test, docker-build)
|
||||
|
||||
---
|
||||
|
||||
## Quickstart 🔧
|
||||
|
||||
Build and run locally:
|
||||
|
||||
```bash
|
||||
make build
|
||||
./bin/server
|
||||
```
|
||||
|
||||
Run tests:
|
||||
|
||||
```bash
|
||||
make test
|
||||
```
|
||||
|
||||
Build Docker image:
|
||||
|
||||
```bash
|
||||
make docker-build
|
||||
```
|
||||
|
||||
Then run it:
|
||||
|
||||
```bash
|
||||
docker run -p 8080:8080 lambda-iot-core:latest
|
||||
```
|
||||
|
||||
### Endpoints
|
||||
|
||||
- `http://localhost:8080/health` — returns `{ "status": "ok" }`
|
||||
- `http://localhost:8080/hello` — returns a small greeting JSON
|
||||
- `POST http://localhost:8080/login` — demo login, JSON body: `{ "username": "admin", "password": "password" }`, returns `{ "token": "..." }`
|
||||
- `GET http://localhost:8080/protected` — protected endpoint requiring `Authorization: Bearer <token>` header
|
||||
|
||||
### Environment
|
||||
|
||||
- `JWT_SECRET` — (optional) secret used to sign tokens; defaults to `secret` for local/dev use
|
||||
|
||||
---
|
||||
|
||||
If you want I can wire more features (structured logging, config, middleware, or dependency injection). Just tell me which direction to take. 🎯
|
||||
Reference in New Issue
Block a user