chore: 🔧 clean up code structure and remove unused files
* Refactored several modules for better readability * Removed deprecated functions and variables * Improved overall project organization
This commit is contained in:
82
pkg/handlers/static/README.md
Normal file
82
pkg/handlers/static/README.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# 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:
|
||||
```bash
|
||||
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:**
|
||||
```bash
|
||||
vim pkg/handlers/static/index.html
|
||||
```
|
||||
|
||||
2. **Rebuild the server:**
|
||||
```bash
|
||||
go build ./cmd/server/
|
||||
```
|
||||
|
||||
3. **Restart the server:**
|
||||
```bash
|
||||
./server -config bin/config.json
|
||||
```
|
||||
|
||||
The changes will be embedded in the new binary.
|
||||
|
||||
## Updating the Logo
|
||||
|
||||
1. **Replace the logo:**
|
||||
```bash
|
||||
cp path/to/new-logo.png pkg/handlers/static/logo.png
|
||||
```
|
||||
|
||||
2. **Rebuild:**
|
||||
```bash
|
||||
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
|
||||
Reference in New Issue
Block a user