Skip to content

Commit

Permalink
**API Change** renamed library package
Browse files Browse the repository at this point in the history
  • Loading branch information
jpillora committed Sep 2, 2015
1 parent 52ab0a9 commit 01527c8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
14 changes: 7 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import (

"github.com/jpillora/opts"
"github.com/jpillora/requestlog"
"github.com/jpillora/serve/handler"
"github.com/jpillora/serve/serve"
)

var VERSION string = "0.0.0"

type Config struct {
Host string `help:"Host interface"`
Port int `help:"Listening port"`
Open bool `help:"On server startup, open the root in the default browser (uses the 'open' command)"`
handler.Config `type:"embedded"`
Host string `help:"Host interface"`
Port int `help:"Listening port"`
Open bool `help:"On server startup, open the root in the default browser (uses the 'open' command)"`
serve.Config `type:"embedded"`
}

func main() {
Expand All @@ -28,7 +28,7 @@ func main() {
c := Config{
Host: "0.0.0.0",
Port: 3000,
Config: handler.Config{
Config: serve.Config{
Directory: ".",
},
}
Expand All @@ -41,7 +41,7 @@ func main() {
Parse()

//ready!
h, err := handler.New(c.Config)
h, err := serve.NewHandler(c.Config)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion handler/handler_config.go → serve/config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package handler
package serve

//Config is a handler configuration
type Config struct {
Expand Down
8 changes: 2 additions & 6 deletions handler/handler.go → serve/handler.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package handler
package serve

import (
"fmt"
Expand Down Expand Up @@ -32,12 +32,8 @@ type Handler struct {
lr *lrserver.Server
}

func Directory(dir string) (http.Handler, error) {
return New(Config{Directory: dir})
}

//NewServer creates a new Server
func New(c Config) (http.Handler, error) {
func NewHandler(c Config) (http.Handler, error) {
s := &Handler{
c: c,
served: map[string]bool{},
Expand Down
2 changes: 1 addition & 1 deletion handler/handler_dirlist.go → serve/handler_dirlist.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package handler
package serve

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion handler/utils.go → serve/utils.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package handler
package serve

import (
"os/user"
Expand Down

0 comments on commit 01527c8

Please sign in to comment.