Skip to content
Permalink
Browse files

Moved all Go code to vendor for portability

  • Loading branch information...
josephspurrier committed Apr 29, 2016
1 parent 993b4a5 commit b9cfb69375253352f4c9af720abb79a96cf0cb97
@@ -60,16 +60,23 @@ by JavaScript in the static folder.

## Structure

Recently, the folder structure changed. After looking at all the forks
and reusing my project in different places, I decided to move the Go code to the
**app** folder inside the **vendor** folder so the github path is not littered
throughout the many imports. I did not want to use relative paths so the vendor
folder seemed like the best option.

The project is organized into the following folders:

~~~
config - application settings and database schema
controller - page logic organized by HTTP methods (GET, POST)
model - database queries
route - route information and middleware
shared - packages for templates, MySQL, cryptography, sessions, and json
static - location of statically served files like CSS and JS
template - HTML templates
vendor/app/controller - page logic organized by HTTP methods (GET, POST)
vendor/app/shared - packages for templates, MySQL, cryptography, sessions, and json
vendor/app/model - database queries
vendor/app/route - route information and middleware
~~~

There are a few external packages:
@@ -87,7 +94,7 @@ github.com/mattn/go-sqlite3 - SQLite driver
golang.org/x/crypto/bcrypt - password hashing algorithm
~~~

The templates are organized into folders:
The templates are organized into folders under the **template** folder:

~~~
about/about.tmpl - quick info about the app
@@ -6,15 +6,15 @@ import (
"os"
"runtime"

"github.com/josephspurrier/gowebapp/route"
"github.com/josephspurrier/gowebapp/shared/database"
"github.com/josephspurrier/gowebapp/shared/email"
"github.com/josephspurrier/gowebapp/shared/jsonconfig"
"github.com/josephspurrier/gowebapp/shared/recaptcha"
"github.com/josephspurrier/gowebapp/shared/server"
"github.com/josephspurrier/gowebapp/shared/session"
"github.com/josephspurrier/gowebapp/shared/view"
"github.com/josephspurrier/gowebapp/shared/view/plugin"
"app/route"
"app/shared/database"
"app/shared/email"
"app/shared/jsonconfig"
"app/shared/recaptcha"
"app/shared/server"
"app/shared/session"
"app/shared/view"
"app/shared/view/plugin"
)

// *****************************************************************************
@@ -3,7 +3,7 @@ package controller
import (
"net/http"

"github.com/josephspurrier/gowebapp/shared/view"
"app/shared/view"
)

// AboutGET displays the About page
File renamed without changes.
@@ -3,8 +3,8 @@ package controller
import (
"net/http"

"github.com/josephspurrier/gowebapp/shared/session"
"github.com/josephspurrier/gowebapp/shared/view"
"app/shared/session"
"app/shared/view"
)

// IndexGET displays the home page
@@ -5,10 +5,10 @@ import (
"log"
"net/http"

"github.com/josephspurrier/gowebapp/model"
"github.com/josephspurrier/gowebapp/shared/passhash"
"github.com/josephspurrier/gowebapp/shared/session"
"github.com/josephspurrier/gowebapp/shared/view"
"app/model"
"app/shared/passhash"
"app/shared/session"
"app/shared/view"

"github.com/gorilla/sessions"
"github.com/josephspurrier/csrfbanana"
@@ -5,9 +5,9 @@ import (
"log"
"net/http"

"github.com/josephspurrier/gowebapp/model"
"github.com/josephspurrier/gowebapp/shared/session"
"github.com/josephspurrier/gowebapp/shared/view"
"app/model"
"app/shared/session"
"app/shared/view"

"github.com/gorilla/context"
"github.com/josephspurrier/csrfbanana"
@@ -4,11 +4,11 @@ import (
"log"
"net/http"

"github.com/josephspurrier/gowebapp/model"
"github.com/josephspurrier/gowebapp/shared/passhash"
"github.com/josephspurrier/gowebapp/shared/recaptcha"
"github.com/josephspurrier/gowebapp/shared/session"
"github.com/josephspurrier/gowebapp/shared/view"
"app/model"
"app/shared/passhash"
"app/shared/recaptcha"
"app/shared/session"
"app/shared/view"

"github.com/josephspurrier/csrfbanana"
)
File renamed without changes.
File renamed without changes.
@@ -7,7 +7,7 @@ import (
"log"
"time"

"github.com/josephspurrier/gowebapp/shared/database"
"app/shared/database"

"github.com/boltdb/bolt"
"gopkg.in/mgo.v2/bson"
@@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/josephspurrier/gowebapp/shared/database"
"app/shared/database"

"gopkg.in/mgo.v2/bson"
)
@@ -3,7 +3,7 @@ package acl
import (
"net/http"

"github.com/josephspurrier/gowebapp/shared/session"
"app/shared/session"
)

// DisallowAuth does not allow authenticated users to access the page
@@ -3,12 +3,12 @@ package route
import (
"net/http"

"github.com/josephspurrier/gowebapp/controller"
"github.com/josephspurrier/gowebapp/route/middleware/acl"
hr "github.com/josephspurrier/gowebapp/route/middleware/httprouterwrapper"
"github.com/josephspurrier/gowebapp/route/middleware/logrequest"
"github.com/josephspurrier/gowebapp/route/middleware/pprofhandler"
"github.com/josephspurrier/gowebapp/shared/session"
"app/controller"
"app/route/middleware/acl"
hr "app/route/middleware/httprouterwrapper"
"app/route/middleware/logrequest"
"app/route/middleware/pprofhandler"
"app/shared/session"

"github.com/gorilla/context"
"github.com/josephspurrier/csrfbanana"
File renamed without changes.
@@ -4,7 +4,7 @@ import (
"html/template"
"log"

"github.com/josephspurrier/gowebapp/shared/view"
"app/shared/view"
)

// TagHelper returns a template.FuncMap
@@ -12,7 +12,7 @@ import (
"strings"
"sync"

"github.com/josephspurrier/gowebapp/shared/session"
"app/shared/session"
)

func init() {

0 comments on commit b9cfb69

Please sign in to comment.
You can’t perform that action at this time.