Base URL: http://localhost:8080
Create a new collaborative document.
Endpoint: POST /api/documents
Request Body:
{
"title": "My Document",
"content": "Initial content"
}Response: 201 Created
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "My Document",
"content": "Initial content",
"createdAt": "2026-01-12T10:00:00Z",
"updatedAt": "2026-01-12T10:00:00Z",
"version": 1
}Example:
curl -X POST http://localhost:8080/api/documents \
-H "Content-Type: application/json" \
-d '{"title":"My Document","content":"Hello World"}'Get all documents.
Endpoint: GET /api/documents
Response: 200 OK
[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "My Document",
"content": "Hello World",
"createdAt": "2026-01-12T10:00:00Z",
"updatedAt": "2026-01-12T10:00:00Z",
"version": 1
}
]Example:
curl http://localhost:8080/api/documentsRetrieve a specific document by ID.
Endpoint: GET /api/documents/{documentId}
Response: 200 OK
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "My Document",
"content": "Hello World",
"createdAt": "2026-01-12T10:00:00Z",
"updatedAt": "2026-01-12T10:00:00Z",
"version": 1
}Error Response: 404 Not Found
{
"error": "Document not found"
}Example:
curl http://localhost:8080/api/documents/550e8400-e29b-41d4-a716-446655440000Update an existing document.
Endpoint: PUT /api/documents/{documentId}
Request Body:
{
"content": "Updated content"
}Response: 200 OK
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "My Document",
"content": "Updated content",
"createdAt": "2026-01-12T10:00:00Z",
"updatedAt": "2026-01-12T10:05:00Z",
"version": 2
}Example:
curl -X PUT http://localhost:8080/api/documents/550e8400-e29b-41d4-a716-446655440000 \
-H "Content-Type: application/json" \
-d '{"content":"Updated content"}'Delete a document.
Endpoint: DELETE /api/documents/{documentId}
Response: 204 No Content
Error Response: 404 Not Found
Example:
curl -X DELETE http://localhost:8080/api/documents/550e8400-e29b-41d4-a716-446655440000Check server health.
Endpoint: GET /health
Response: 200 OK
{
"status": "healthy"
}Example:
curl http://localhost:8080/healthServer: quic://localhost:4433
tlsConfig := &tls.Config{
InsecureSkipVerify: true, // Only for development
NextProtos: []string{"collaborative-doc-quic"},
}
conn, err := quic.DialAddr("localhost:4433", tlsConfig, nil)stream, err := conn.OpenStreamSync(context.Background()){
"type": "join",
"documentId": "550e8400-e29b-41d4-a716-446655440000",
"clientId": "client-123"
}{
"type": "init",
"document": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"title": "My Document",
"content": "Hello World",
"version": 1
}
}{
"type": "operation",
"operation": {
"type": "insert",
"position": 5,
"text": " there",
"version": 1,
"clientId": "client-123"
}
}{
"type": "operation",
"operation": {
"type": "insert",
"position": 11,
"text": "!",
"version": 2,
"clientId": "client-456"
}
}{
"type": "insert",
"position": 10,
"text": "Hello",
"version": 1,
"clientId": "client-123"
}{
"type": "delete",
"position": 5,
"length": 3,
"version": 2,
"clientId": "client-123"
}{
"type": "error",
"message": "Document not found"
}