sliproad/webserver.go
Gabriel Simmer 641e015ca6
Simplify router, remove common and authentication.
Removed common package, since it was largely useless and instead
integrated what I could into the router package. Should simplify things
going forward, but we can always split this out later. Also completely
removed authentication for the time being - want to consider other
options for this.
2020-04-02 20:50:39 +01:00

30 lines
550 B
Go

package main
import (
"fmt"
"github.com/gmemstr/nas/files"
"github.com/gmemstr/nas/router"
"github.com/go-yaml/yaml"
"io/ioutil"
"log"
"net/http"
)
// Main function that defines routes
func main() {
// Initialize file providers.
file, err := ioutil.ReadFile("providers.yml")
if err != nil {
panic(err)
}
err = yaml.Unmarshal(file, &files.ProviderConfig)
if err != nil {
panic(err)
}
files.SetupProviders()
r := router.Init()
fmt.Println("Your NAS instance is live on port :3000")
log.Fatal(http.ListenAndServe(":3000", r))
}