mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
parent
591e0ad995
commit
ed80286431
@ -16,17 +16,14 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var (
|
||||
host = flag.String("host", "", "host name")
|
||||
port = flag.Int("port", 8000, "port number")
|
||||
httpAddr = flag.String("http", ":8000", "HTTP address")
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -42,10 +39,5 @@ func init() {
|
||||
|
||||
func main() {
|
||||
http.Handle("/", http.FileServer(http.Dir(rootPath)))
|
||||
if *host == "" {
|
||||
fmt.Printf("http://127.0.0.1:%d/\n", *port)
|
||||
} else {
|
||||
fmt.Printf("http://%s:%d/\n", *host, *port)
|
||||
}
|
||||
log.Fatal(http.ListenAndServe(*host+":"+strconv.Itoa(*port), nil))
|
||||
log.Fatal(http.ListenAndServe(*httpAddr, nil))
|
||||
}
|
||||
|
@ -28,13 +28,11 @@ import (
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
host = flag.String("host", "", "host name")
|
||||
port = flag.Int("port", 8000, "port number")
|
||||
httpAddr = flag.String("http", ":8000", "HTTP address")
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -168,10 +166,5 @@ func main() {
|
||||
http.HandleFunc("/main.js", serveMainJS)
|
||||
http.HandleFunc("/main.js.map", serveMainJSMap)
|
||||
http.HandleFunc("/", serveFileHandle)
|
||||
if *host == "" {
|
||||
fmt.Printf("http://127.0.0.1:%d/\n", *port)
|
||||
} else {
|
||||
fmt.Printf("http://%s:%d/\n", *host, *port)
|
||||
}
|
||||
log.Fatal(http.ListenAndServe(*host+":"+strconv.Itoa(*port), nil))
|
||||
log.Fatal(http.ListenAndServe(*httpAddr, nil))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user