Refactoring code to use packages
This commit is contained in:
		
							
								
								
									
										19
									
								
								cmd/web/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								cmd/web/main.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"go-udemy-web-1/pkg/handlers"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const portNumber = ":8080"
 | 
			
		||||
 | 
			
		||||
// main is the main application function
 | 
			
		||||
func main() {
 | 
			
		||||
	http.HandleFunc("/", handlers.Home)
 | 
			
		||||
	http.HandleFunc("/about", handlers.About)
 | 
			
		||||
 | 
			
		||||
	fmt.Printf("Starting application on port %s\n", portNumber)
 | 
			
		||||
 | 
			
		||||
	_ = http.ListenAndServe(portNumber, nil)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user