init hello world
This commit is contained in:
31
main.go
31
main.go
@@ -1,7 +1,34 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/signal"
|
||||
|
||||
"git.dubyatp.xyz/orphanage/http"
|
||||
)
|
||||
|
||||
func run(ctx context.Context, w io.Writer, args []string) error {
|
||||
ctx, cancel := signal.NotifyContext(ctx, os.Interrupt)
|
||||
defer cancel()
|
||||
|
||||
config := struct {
|
||||
Host string
|
||||
Port string
|
||||
}{
|
||||
Host: "0.0.0.0",
|
||||
Port: "8080",
|
||||
}
|
||||
|
||||
return http.StartServer(ctx, config)
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello, World!")
|
||||
ctx := context.Background()
|
||||
if err := run(ctx, os.Stdout, os.Args); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user