Files
whatshooked/pkg/handlers/static
Hein c5e121de4a
Some checks failed
CI / Test (1.22) (push) Failing after -24m45s
CI / Test (1.23) (push) Failing after -24m42s
CI / Build (push) Successful in -26m57s
CI / Lint (push) Successful in -26m48s
chore: 🔧 clean up code structure and remove unused files
* Refactored several modules for better readability
* Removed deprecated functions and variables
* Improved overall project organization
2026-01-30 16:59:22 +02:00
..

Static Files

This directory contains the embedded static files for the WhatsHooked landing page.

Files

  • index.html - Landing page with API documentation
  • logo.png - WhatsHooked logo (from assets/image/whatshooked_tp.png)

How It Works

These files are embedded into the Go binary using go:embed directive in static.go.

When you build the server:

go build ./cmd/server/

The files in this directory are compiled directly into the binary, so the server can run without any external files.

Updating the Landing Page

  1. Edit the HTML:

    vim pkg/handlers/static/index.html
    
  2. Rebuild the server:

    go build ./cmd/server/
    
  3. Restart the server:

    ./server -config bin/config.json
    

The changes will be embedded in the new binary.

  1. Replace the logo:

    cp path/to/new-logo.png pkg/handlers/static/logo.png
    
  2. Rebuild:

    go build ./cmd/server/
    

Routes

  • GET / - Serves index.html
  • GET /static/logo.png - Serves logo.png
  • GET /static/* - Serves any file in this directory

Development Tips

  • Files are cached with Cache-Control: public, max-age=3600 (1 hour)
  • Force refresh in browser: Ctrl+Shift+R or Cmd+Shift+R
  • Changes require rebuild - no hot reload
  • Keep files small - they're embedded in the binary

File Structure

pkg/handlers/
├── static.go         # Handler with go:embed directive
├── static/
│   ├── index.html    # Landing page
│   ├── logo.png      # Logo image
│   └── README.md     # This file

Benefits of Embedded Files

Single binary deployment - No external dependencies Fast serving - Files loaded from memory No file system access - Works in restricted environments Portable - Binary includes everything Version controlled - Static assets tracked with code