Skip to content

HuolalaTech/page-spy-api

Repository files navigation

Page Spy API

PageSpy is a developer platform for debugging web page.

license API Version Go Version

PageSpy - Remote debugging as seamless as local debugging. | Product Hunt PageSpy - Remote debugging as seamless as local debugging. | Hacker News

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.