New skeleton

This commit is contained in:
Felix Geisendörfer 2013-05-02 15:25:02 +02:00
parent 36cda94bb6
commit f25c3c71ae
6 changed files with 40 additions and 2 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/tus_data /tus_data
/gopath

9
dev.sh Normal file
View File

@ -0,0 +1,9 @@
#!/usr/bin/bash
# usage: source dev.sh
#
# dev.sh simplifies development by setting up a local GOPATH.
export GOPATH=`pwd`/gopath
src_dir="${GOPATH}/src/github.com/tus/tusd"
mkdir -p "${src_dir}"
ln -fs "`pwd`/src" "${src_dir}"

View File

@ -2,13 +2,23 @@ package main
import ( import (
"log" "log"
tushttp "github.com/tus/tusd/src/http"
"net/http"
"os"
) )
func main() { func main() {
log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds) log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds)
log.Printf("tusd started") log.Printf("tusd started")
if err := serveHttp(); err != nil { addr := ":1080"
log.Fatal(err) if port := os.Getenv("TUSD_PORT"); port != "" {
addr = ":" + port
}
log.Printf("servering clients at http://localhost%s", addr)
handler := tushttp.NewHandler()
if err := http.ListenAndServe(addr, handler); err != nil {
panic(err)
} }
} }

1
src/http/client.go Normal file
View File

@ -0,0 +1 @@
package http

3
src/http/doc.go Normal file
View File

@ -0,0 +1,3 @@
// Package http contains a client and server implementation of the tus protocol
// and is meant to be used by other applications.
package http

14
src/http/handler.go Normal file
View File

@ -0,0 +1,14 @@
package http
import (
"net/http"
)
func NewHandler() *Handler {
return &Handler{}
}
type Handler struct {}
func (h *Handler) ServeHTTP(http.ResponseWriter, *http.Request) {
}