more restructuring
This commit is contained in:
parent
199aa57c96
commit
4ba952092c
@ -1,9 +1,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"git.nils.zone/clientserverapi/server/storage"
|
"git.nils.zone/clientserverapi/server/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -13,7 +10,3 @@ func check(err error) {
|
|||||||
}
|
}
|
||||||
storage.GetComputers()
|
storage.GetComputers()
|
||||||
}
|
}
|
||||||
|
|
||||||
func homePage(w http.ResponseWriter, r *http.Request) {
|
|
||||||
fmt.Fprintf(w, "Nothing here...")
|
|
||||||
}
|
|
||||||
|
5
main.go
5
main.go
@ -2,12 +2,17 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func homePage(w http.ResponseWriter, r *http.Request) {
|
||||||
|
fmt.Fprintf(w, "Nothing here...")
|
||||||
|
}
|
||||||
|
|
||||||
func handleRequests(runmode string) {
|
func handleRequests(runmode string) {
|
||||||
// creates a new instance of a mux router
|
// creates a new instance of a mux router
|
||||||
router := mux.NewRouter().StrictSlash(true)
|
router := mux.NewRouter().StrictSlash(true)
|
||||||
|
12
shared/functions.go
Normal file
12
shared/functions.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package shared
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.nils.zone/clientserverapi/server/storage"
|
||||||
|
)
|
||||||
|
|
||||||
|
func check(err error) {
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
storage.GetComputers()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user