Week 1 Challenge: Lua HTTP-Server Implementation for Mail-Service #63

Closed
opened 2025-06-17 19:27:06 +02:00 by Michael · 0 comments
Michael commented 2025-06-17 19:27:06 +02:00 (Migrated from gitea.dragons-at-work.de)

Objective

Implement basic HTTP-Server in Pure Lua as first step of Furt API-Gateway (replacing planned Go implementation).

Success Criteria (1 Week)

  • HTTP-Server works: curl -X POST http://localhost:8080/test → HTTP 200
  • Request parsing: POST-Body und Headers korrekt gelesen
  • JSON responses: Strukturierte API-Responses
  • Basic routing: /v1/mail/send Endpoint implementiert
  • Environment ready: Alle Lua-Dependencies installiert

Technical Specifications

Dependencies Status (VERIFIED)

All dependencies tested and working on Arch Linux:

  • lua 5.4.8 (installed)
  • lua-socket (HTTP ready)
  • lua-ssl (HTTPS ready)
  • lua-cjson (JSON ready)

File Structure to Create

furt-lua/
├── src/
│ ├── main.lua # HTTP-Server (50-100 Zeilen)
│ ├── request_parser.lua # Request-Parsing (< 100 Zeilen)
│ └── response.lua # Response-Formatting (< 50 Zeilen)
├── config/
│ └── server.lua # Server-Konfiguration
├── scripts/
│ └── start.sh # Start-Script
└── tests/
└── test_http.lua # Basic HTTP-Tests

Implementation Milestones

Day 1: Basic HTTP-Server

  • lua-socket based HTTP-Server
  • Listen on Port 8080
  • Basic request/response cycle

Day 2: Request Parsing

  • POST-Body parsing
  • Header extraction
  • JSON request handling

Day 3: Response Formatting

  • JSON response generation
  • HTTP status codes
  • Error handling

Day 4: Routing

  • Path-based routing
  • /v1/mail/send endpoint
  • Basic validation

Day 5: Testing

  • curl-based tests
  • Error case testing
  • Performance verification

Module Size Constraint

  • Each Lua file: < 200 lines
  • Each function: < 50 lines
  • No monolithic files!

Testing Requirements

  • Basic curl-tests documented
  • Error cases handled
  • Performance: < 100ms response time

Next Steps After HTTP-Server

  1. Mail-Handler implementation (SMTP integration)
  2. API-Key authentication
  3. Hugo-Integration testing
  4. HTTPS with lua-ssl

Session Goal

Ende der nächsten Session: Funktionierender Lua-HTTP-Server für Mail-API bereit für SMTP-Integration.

Priority: High - Foundation für gesamte Furt-Migration
Effort: Small - 1 Session Implementation
Dependencies: All verified and ready

## Objective Implement basic HTTP-Server in Pure Lua as first step of Furt API-Gateway (replacing planned Go implementation). ## Success Criteria (1 Week) - [x] HTTP-Server works: curl -X POST http://localhost:8080/test → HTTP 200 - [x] Request parsing: POST-Body und Headers korrekt gelesen - [x] JSON responses: Strukturierte API-Responses - [x] Basic routing: /v1/mail/send Endpoint implementiert - [x] Environment ready: Alle Lua-Dependencies installiert ✅ ## Technical Specifications ### Dependencies Status (VERIFIED) All dependencies tested and working on Arch Linux: - ✅ lua 5.4.8 (installed) - ✅ lua-socket (HTTP ready) - ✅ lua-ssl (HTTPS ready) - ✅ lua-cjson (JSON ready) ### File Structure to Create furt-lua/ ├── src/ │ ├── main.lua # HTTP-Server (50-100 Zeilen) │ ├── request_parser.lua # Request-Parsing (< 100 Zeilen) │ └── response.lua # Response-Formatting (< 50 Zeilen) ├── config/ │ └── server.lua # Server-Konfiguration ├── scripts/ │ └── start.sh # Start-Script └── tests/ └── test_http.lua # Basic HTTP-Tests ### Implementation Milestones **Day 1: Basic HTTP-Server** - lua-socket based HTTP-Server - Listen on Port 8080 - Basic request/response cycle **Day 2: Request Parsing** - POST-Body parsing - Header extraction - JSON request handling **Day 3: Response Formatting** - JSON response generation - HTTP status codes - Error handling **Day 4: Routing** - Path-based routing - /v1/mail/send endpoint - Basic validation **Day 5: Testing** - curl-based tests - Error case testing - Performance verification ## Module Size Constraint - Each Lua file: < 200 lines - Each function: < 50 lines - No monolithic files! ## Testing Requirements - Basic curl-tests documented - Error cases handled - Performance: < 100ms response time ## Next Steps After HTTP-Server 1. Mail-Handler implementation (SMTP integration) 2. API-Key authentication 3. Hugo-Integration testing 4. HTTPS with lua-ssl ## Session Goal Ende der nächsten Session: Funktionierender Lua-HTTP-Server für Mail-API bereit für SMTP-Integration. **Priority:** High - Foundation für gesamte Furt-Migration **Effort:** Small - 1 Session Implementation **Dependencies:** All verified and ready ✅
michael added this to the v0.1.2 - Gateway Basics milestone 2025-08-14 05:21:02 +02:00
michael added
status
done
and removed
status
to-go
labels 2025-08-14 07:23:17 +02:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: DAW/furt#63
No description provided.