Parcourir la source

Added reading args. First arg = port

Dasflugen il y a 5 ans
Parent
commit
11385149b9
4 fichiers modifiés avec 4 ajouts et 8 suppressions
  1. 0 3
      log/Requests_API.log
  2. 0 3
      log/Requests_URL.log
  3. BIN
      main
  4. 4 2
      main.go

+ 0 - 3
log/Requests_API.log

@@ -1,3 +0,0 @@
-[11:22AM] GET request from 192.168.13.35:49050 to /api/teacher/
-[11:22AM] GET request from 192.168.13.35:49050 to /api/teacher/
-[11:22AM] GET request from 192.168.13.35:49050 to /api/group/

+ 0 - 3
log/Requests_URL.log

@@ -1,3 +0,0 @@
-[11:22] Request from 192.168.13.35:49048 to /groupcard/
-[11:22] Request from 192.168.13.35:49048 to /groupcard/
-[11:22] Request from 192.168.13.35:49048 to /group/

BIN
main


+ 4 - 2
main.go

@@ -30,6 +30,7 @@ func init() {
 }
 
 func main() {
+	
 	http.Handle("/static/", http.StripPrefix(
 		"/static/",
 		handleFileServer(http.Dir(PATH_STATIC))),
@@ -102,10 +103,11 @@ func main() {
 	http.HandleFunc("/wekan", wekanRedirect)
 	http.HandleFunc("/test/", testPage) // testing token
 	// HTTP pages handling end
-
+	port := os.Args[1]
 	api.PrintConsole("Server is listening")
+	fmt.Println(port)
 
-	http.ListenAndServe(":80", nil)
+	http.ListenAndServe(":" + port, nil)
 }
 
 func wekanRedirect(w http.ResponseWriter, r *http.Request){