Skip to content

Commit

Permalink
Merge pull request #13 from joegasewicz/Create-a-UI-#3
Browse files Browse the repository at this point in the history
  • Loading branch information
joegasewicz authored May 23, 2024
2 parents 6063412 + 2ffb00d commit 5957478
Show file tree
Hide file tree
Showing 44 changed files with 2,462 additions and 9 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.idea
dentitydb_vol

identitydb_vol
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
Expand All @@ -21,4 +21,7 @@ dentitydb_vol
# vendor/

# Go workspace file
go.work
go.work

node_modules
dist
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
![Locksmith](public/img/locksmith-logo.png?raw=true "Locksmith")
Identity server

### Admin Console
![Admin Console](public/img/screenshot-1.png?raw=true "Admin Console")

### Usages
To run locksmith locally, first run the docker-compose make cmd
```
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21.6

require (
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/joegasewicz/gomek v0.4.7
github.com/joegasewicz/gomek v0.4.8
github.com/joegasewicz/pg-conf v0.1.2
golang.org/x/crypto v0.19.0
gorm.io/driver/postgres v1.5.6
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/joegasewicz/gomek v0.4.7 h1:fAUenmIsMkNm+8yUtU50A8G/9udVyGUJXUBizwqQEX8=
github.com/joegasewicz/gomek v0.4.7/go.mod h1:xIA1E1/iQc/4XB+YgiKDYtfH5wmUXRn78DocLH5urGI=
github.com/joegasewicz/gomek v0.4.8 h1:oPSEZY4yQDJk0VvY9tdDpMrueUZHUkMa63rSxnpqO3g=
github.com/joegasewicz/gomek v0.4.8/go.mod h1:xIA1E1/iQc/4XB+YgiKDYtfH5wmUXRn78DocLH5urGI=
github.com/joegasewicz/pg-conf v0.1.2 h1:MeBgfuu/N1HRQDp+/RPtctPR0phA65PhgG5W2aZ4D1g=
github.com/joegasewicz/pg-conf v0.1.2/go.mod h1:lbNke2WCF6IMgYVeLRLqan/1m9jrQSuYuJVEgMRbp4g=
github.com/joegasewicz/status-writer v1.0.0 h1:cTj5iymQNypLtlIlR3gByLGiBhYsvYZ4rMSdsUlbrHE=
Expand Down
4 changes: 4 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const content: any;
export default content;
}
31 changes: 25 additions & 6 deletions locksmith.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func main() {
s.CreateUser(&y.Yaml)

var whiteList = [][]string{
{
"/", "GET",
},
{
"/health", "GET",
},
Expand All @@ -41,20 +44,36 @@ func main() {
{
"/login", "POST",
},
{
"/health", "GET",
},
}

c := gomek.Config{}
c := gomek.Config{
BaseTemplateName: "layout",
BaseTemplates: []string{
"./templates/layout.gohtml",
"./templates/partials/footer.gohtml",
"./templates/partials/header.gohtml",
"./templates/partials/navbar.gohtml",
"./templates/partials/scripts.gohtml",
},
}
app := gomek.New(c)

// views
app.Route("/health").View(views.Health).Methods("GET")
// static files
distFiles := http.FileServer(http.Dir("dist"))
publicFiles := http.FileServer(http.Dir("public"))
app.Handle("/dist/", http.StripPrefix("/dist/", distFiles))
app.Handle("/public/", http.StripPrefix("/public/", publicFiles))

// api views
app.Route("/health").View(views.Health).Methods("GET")
app.Route("/login").View(views.Login).Methods("POST")
app.Route("/users").Resource(&views.Users{}).Methods("POST", "GET", "PUT", "DELETE")

// template views
app.Route("/").Resource(&views.Home{}).Methods("GET").Templates(
"./templates/views/home.gohtml",
)

// middleware
app.Use(gomek.CORS)
app.Use(gomek.Authorize(whiteList, func(r *http.Request) (bool, context.Context) {
Expand Down
Loading

0 comments on commit 5957478

Please sign in to comment.