Skip to content

barandemirbas/open-with

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report Card Go Reference

Getting Started

Install Open With

go get -u github.com/barandemirbas/open-with

Add to your imports to start using Open With

import "github.com/barandemirbas/open-with"

Functions

Browser function opens a new browser tab for pointing url with default browser.

openwith.Browser("https://github.com/barandemirbas/open-with")
openwith.Browser("127.0.0.1", 8000) // http://127.0.0.1:8000
openwith.Browser("127.0.0.1/path", 8000) // http://127.0.0.1:8000/path 

Examples

Example with Browser function:

package main

import (
	"github.com/barandemirbas/open-with"
	"net/http"
)

type HttpHandler struct{}

func (h HttpHandler) ServeHTTP(res http.ResponseWriter, req *http.Request) {
	res.Write([]byte("Hello World!"))
}

func main() {
	openwith.Browser("127.0.0.1", 8000)
	http.ListenAndServe(":8000", HttpHandler{})
}