godaemon

package module
v0.0.0-...-5313b8a Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 4 Imported by: 0

README

godaemon

Run golang app as background program, 以后台形式运行golang

安装:

go get github.com/Sunbalcony/godaemon

示例:

package main

import (
	_ "github.com/Sunbalcony/godaemon"
	"log"
	"net/http"
)

func main() {
	mux := http.NewServeMux()
	mux.HandleFunc("/index", func(rw http.ResponseWriter, req *http.Request) {
		rw.Write([]byte("hello, golang!\n"))
	})
	log.Fatalln(http.ListenAndServe(":7070", mux))
}

运行

./example -d=true
~$ curl http://127.0.0.1:7070/index
hello, golang!

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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