mirror of
				https://github.com/SourceFellows/gobuch.git
				synced 2025-11-04 07:36:19 +01:00 
			
		
		
		
	initial import
This commit is contained in:
		
							
								
								
									
										16
									
								
								microservices/http-metod-matching/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								microservices/http-metod-matching/main.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import "net/http"
 | 
			
		||||
 | 
			
		||||
func myHandler(res http.ResponseWriter, req *http.Request) {
 | 
			
		||||
	if req.Method == http.MethodGet {
 | 
			
		||||
		res.Write([]byte("Hello World"))
 | 
			
		||||
	} else {
 | 
			
		||||
		res.WriteHeader(http.StatusMethodNotAllowed)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	http.HandleFunc("/", myHandler)
 | 
			
		||||
	http.ListenAndServe(":8080", nil)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user