Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I embed this into my go server? #1

Closed
vkhobor opened this issue Jun 10, 2024 · 4 comments
Closed

Can I embed this into my go server? #1

vkhobor opened this issue Jun 10, 2024 · 4 comments

Comments

@vkhobor
Copy link
Contributor

vkhobor commented Jun 10, 2024

Hi. Is it possible to embed this into my server without a reverse proxy?

@kevincobain2000
Copy link
Owner

Thanks. I think it can be done. Will work on it.

@kevincobain2000
Copy link
Owner

kevincobain2000 commented Jun 29, 2024

Action plan

  • Refactor
  • provide http handler for files

Sample end interface may look like

package main

import (
	"fmt"
	"net/http"

    "github.com/kevincobain2000/gol"
)


func helloHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "Hello, World!")
}

func main() {

	http.HandleFunc("/", helloHandler)

         //options := // provide FilePaths to watch
	http.HandleFunc("/gol", gol.Handler(options...)) <-- add this line

	fmt.Println("Starting server on :8080")
	if err := http.ListenAndServe(":8080", nil); err != nil {
		fmt.Println("Error starting server:", err)
	}
}

@vkhobor
Copy link
Contributor Author

vkhobor commented Jun 29, 2024

https://github.com/fullstorydev/grpcui/blob/master/standalone%2Fstandalone.go

Here is something that is a similar thing, maybe you can draw inspiration from. I've came across it a while ago just forgot to send it.

@kevincobain2000
Copy link
Owner

README updated: https://github.com/kevincobain2000/gol?tab=readme-ov-file#embed-in-go

Thanks for the suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants