page-spy-api

module
v1.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: MIT

README

Page Spy API

PageSpy is a developer platform for debugging web page.

license API Version Go Version

English | 中文

What's this

The repo is the backend service for HuolalaTech/page-spy-web, which includes static resource serving, HTTP service, and WebSocket service.

How to use

package main

import (
	"embed"
	"log"

	"github.com/HuolalaTech/page-spy-api/config"
	"github.com/HuolalaTech/page-spy-api/container"
	"github.com/HuolalaTech/page-spy-api/serve"
)

//go:embed dist/*
var publicContent embed.FS

func main() {
	container := container.Container()
	err := container.Provide(func() *config.StaticConfig {
		// page-spy-web build dist static proxy, if no need you can return nil
		return &config.StaticConfig{
			DirName: "dist",
			Files:   publicContent,
		}
	})

	if err != nil {
		log.Fatal(err)
	}

	serve.Run()
}

Directory Structure

  • config: Project configuration.
  • container: Dependency injection.
  • event: Event structure definitions.
  • logger: Logging interface.
  • metric: Metrics interface.
  • room: Room interface.
  • rpc: Multi-machine RPC interface.
  • serve: HTTP and WebSocket services.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL