Adding basic project structure
							parent
							
								
									a1867a881d
								
							
						
					
					
						commit
						80e0429f09
					
				| @ -0,0 +1,6 @@ | ||||
| run: | ||||
| 	go run ./cmd/bugbox/main.go | ||||
| .PHONEY: run | ||||
| 
 | ||||
| test: | ||||
| 	go test -v ./... | ||||
| @ -1,4 +1,18 @@ | ||||
| # Go WTF Dial  | ||||
| # Bug Box | ||||
| 
 | ||||
| This was a series that strives to teach by building a real web application in go lang. Documented on  https://www.gobeyond.dev/wtf-dial/ with source code available at https://github.com/benbjohnson/wtf?ref=gobeyond.dev | ||||
| A RestAPI for managing bug enclosures.  | ||||
| 
 | ||||
| ## Project Structure | ||||
| 
 | ||||
| *Application domain* types reside in the project root and includes a a *Service* interface that serves as a contract for an underlying implementation. A *Service* implementation of the application domain is contained in the appropriate sub package (http, sqlite, etc.). The application is tied together in the `cmd` sub package.  | ||||
| 
 | ||||
| - Organization:   | ||||
| - User:  | ||||
| - Enclosure:  | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| ## Inspiration | ||||
| 
 | ||||
| The structure of this application follows the design patterns laid out in the [WTF-Dail](https://github.com/benbjohnson/wtf?ref=gobeyond.dev) which strives to be a reference implementation for a real golang web application.  | ||||
| 
 | ||||
|  | ||||
| @ -0,0 +1,16 @@ | ||||
| package main | ||||
| 
 | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"io" | ||||
| 	"os" | ||||
| ) | ||||
| 
 | ||||
| func printMessage(w io.Writer, msg string) { | ||||
| 	fmt.Fprint(w, msg) | ||||
| } | ||||
| 
 | ||||
| func main() { | ||||
| 
 | ||||
| 	printMessage(os.Stdout, "Bugbox server\n") | ||||
| } | ||||
| @ -0,0 +1,18 @@ | ||||
| package main | ||||
| 
 | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestMain(t *testing.T) { | ||||
| 	msg := "Bug box server\n" | ||||
| 	buffer := bytes.Buffer{} | ||||
| 	printMessage(&buffer, msg) | ||||
| 	got := buffer.String() | ||||
| 	want := msg | ||||
| 
 | ||||
| 	if got != want { | ||||
| 		t.Errorf("Error, got %s, want %s", got, want) | ||||
| 	} | ||||
| } | ||||
| @ -0,0 +1 @@ | ||||
| package bugbox | ||||
| @ -0,0 +1 @@ | ||||
| package bugbox | ||||
					Loading…
					
					
				
		Reference in New Issue