This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
applied sync.Once to make 'app' to be the only root App
- Loading branch information
Showing
10 changed files
with
60 additions
and
30 deletions.
There are no files selected for viewing
11 changes: 8 additions & 3 deletions
11
internal/genny/actions/_fixtures/inputs/clean/actions/app.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
package actions | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/gobuffalo/buffalo" | ||
) | ||
|
||
var app *buffalo.App | ||
var ( | ||
app *buffalo.App | ||
appOnce sync.Once | ||
) | ||
|
||
func App() *buffalo.App { | ||
if app == nil { | ||
appOnce.Do(func() { | ||
app = buffalo.New(buffalo.Options{}) | ||
app.GET("/", HomeHandler) | ||
|
||
app.ServeFiles("/", assetsBox) // serve files from the public directory | ||
} | ||
}) | ||
|
||
return app | ||
} |
11 changes: 8 additions & 3 deletions
11
internal/genny/actions/_fixtures/outputs/clean/actions/app.go.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
package actions | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/gobuffalo/buffalo" | ||
) | ||
|
||
var app *buffalo.App | ||
var ( | ||
app *buffalo.App | ||
appOnce sync.Once | ||
) | ||
|
||
func App() *buffalo.App { | ||
if app == nil { | ||
appOnce.Do(func() { | ||
app = buffalo.New(buffalo.Options{}) | ||
app.GET("/", HomeHandler) | ||
|
||
app.GET("/user/index", UserIndex) | ||
app.ServeFiles("/", assetsBox) // serve files from the public directory | ||
} | ||
}) | ||
|
||
return app | ||
} |
11 changes: 8 additions & 3 deletions
11
internal/genny/actions/_fixtures/outputs/multi/actions/app.go.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
package actions | ||
|
||
import ( | ||
"sync" | ||
|
||
"github.com/gobuffalo/buffalo" | ||
) | ||
|
||
var app *buffalo.App | ||
var ( | ||
app *buffalo.App | ||
appOnce sync.Once | ||
) | ||
|
||
func App() *buffalo.App { | ||
if app == nil { | ||
appOnce.Do(func() { | ||
app = buffalo.New(buffalo.Options{}) | ||
app.GET("/", HomeHandler) | ||
|
||
app.GET("/user/show", UserShow) | ||
app.GET("/user/edit", UserEdit) | ||
app.ServeFiles("/", assetsBox) // serve files from the public directory | ||
} | ||
}) | ||
|
||
return app | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters