Skip to content

Commit

Permalink
Update the readme and set the port to display on start.
Browse files Browse the repository at this point in the history
  • Loading branch information
josephspurrier committed Apr 24, 2017
1 parent 84cc4c9 commit 594bc8c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

[![Go Report Card](https://goreportcard.com/badge/github.com/josephspurrier/gocleanarchitecture)](https://goreportcard.com/report/github.com/josephspurrier/gocleanarchitecture)
[![GoDoc](https://godoc.org/github.com/josephspurrier/gocleanarchitecture?status.svg)](https://godoc.org/github.com/josephspurrier/gocleanarchitecture)
[![Coverage Status](https://coveralls.io/repos/github/josephspurrier/gocleanarchitecture/badge.svg?branch=master&randid=6)](https://coveralls.io/github/josephspurrier/gocleanarchitecture?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/josephspurrier/gocleanarchitecture/badge.svg?branch=master&randid=7)](https://coveralls.io/github/josephspurrier/gocleanarchitecture?branch=master)

A good example of clean architecture for a web application in Go.

The **domain** folder is for **enterprise** business logic without any
dependencies. These can be structs, interfaces, and functions.

The **usecase** folder is for **application** business logic without any
dependencies with the exception of the domain logic. These can be structs,
interfaces, and functions. There is no usecase folder in this example.
There is no **usecase** folder, but if there was, it would hold the
**application** business logic without any dependencies with the exception of
the domain logic. These can be structs, interfaces, and functions.

The **adapter** folder should contain abstractions for the packages in the
**lib** and **vendor** folders.
Expand Down
8 changes: 6 additions & 2 deletions cmd/webapp/main.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
package main

import (
"fmt"
"log"
"net/http"
)

// main is the entrypoint for the application.
func main() {
// Set the port.
port := 8080

// Register the services and load the routes.
http.Handle("/", RegisterServices("html").LoadRoutes())

// Display message on the server.
log.Println("Server started.")
log.Printf("webapp started on port %v\n", port)

// Run the web listener.
log.Fatal(http.ListenAndServe(":8080", nil))
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%v", port), nil))
}

0 comments on commit 594bc8c

Please sign in to comment.