Compare commits
	
		
			2 Commits
		
	
	
		
			d97a2f3bca
			...
			63d5d0dc59
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 63d5d0dc59 | |||
| b96656a469 | 
							
								
								
									
										18
									
								
								framework/core.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								framework/core.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
package framework
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Core is the core struct of the framework
 | 
			
		||||
type Core struct{}
 | 
			
		||||
 | 
			
		||||
// NewCore initialize the Core.
 | 
			
		||||
func NewCore() *Core {
 | 
			
		||||
	return &Core{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ServeHTTP implements the Handler interface
 | 
			
		||||
func (c *Core) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	// TODO
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								main.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,27 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"html"
 | 
			
		||||
	"log"
 | 
			
		||||
	"net/http"
 | 
			
		||||
 | 
			
		||||
	"git.vinchent.xyz/vinchent/go-web/framework"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type FooHandler struct{}
 | 
			
		||||
 | 
			
		||||
func (foo FooHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	server := &http.Server{
 | 
			
		||||
		Addr:    ":8080",
 | 
			
		||||
		Handler: framework.NewCore(),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := server.ListenAndServe(); err != nil {
 | 
			
		||||
		log.Panic(err)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user