Skip to content

Implement REST API Server with HTTP Interface #1

Description

@AnshSinghSonkhia

Priority: High
Category: API & Interface
Estimated Effort: Medium

Description

Currently, GoVaultFS only provides a programmatic Go API. Adding a REST API server would enable:

  • Web-based file upload/download
  • Integration with other applications
  • Remote management capabilities
  • HTTP-based file sharing

Implementation Plan

  1. Create HTTP Server Module (api/server.go)

    • Implement REST endpoints:
      • POST /files - Upload file
      • GET /files/{hash} - Download file by hash
      • DELETE /files/{hash} - Delete file
      • GET /files - List stored files
      • GET /peers - List connected peers
      • GET /health - Health check endpoint
  2. Add Middleware Support

    • CORS handling for web clients
    • Request logging and metrics
    • Authentication/authorization (optional)
    • Rate limiting for uploads
  3. Integration Points

    • Wrap existing FileServer methods
    • Handle multipart file uploads
    • Stream file downloads efficiently
    • Return JSON responses with metadata
  4. Configuration

    • Add HTTP port configuration
    • Enable/disable API server
    • Configure max upload size

Files to Create/Modify:

  • api/server.go - HTTP server implementation
  • api/handlers.go - Request handlers
  • api/middleware.go - HTTP middleware
  • main.go - Add HTTP server initialization
  • server.go - Add API integration points

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions