Http server and structures ready

This commit is contained in:
Senad Uka
2020-03-16 22:24:37 +01:00
parent 203db78950
commit 62f2e7c3fd
3 changed files with 132 additions and 0 deletions

20
utils/utils.go Normal file
View File

@@ -0,0 +1,20 @@
package utils
import (
"net/url"
)
// IsValidUrl tests a string to determine if it is a well-structured url or not.
func IsValidUrl(toTest string) bool {
_, err := url.ParseRequestURI(toTest)
if err != nil {
return false
}
u, err := url.Parse(toTest)
if err != nil || u.Scheme == "" || u.Host == "" {
return false
}
return true
}