Skip to content

Commit

Permalink
embed static files
Browse files Browse the repository at this point in the history
  • Loading branch information
PatWie committed Dec 29, 2019
1 parent eb38247 commit 148d541
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ infomark
local/
database/mock.sql
database/query.sql
static/
static/*
!static/.keep



Expand Down Expand Up @@ -54,8 +55,8 @@ api.yaml
*.tar.gz
docker-compose.yml

static/
static
# static/
# static


pkged.go
Expand Down
6 changes: 2 additions & 4 deletions api/app/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"io"
"net/http"
"os"
"path/filepath"
"strings"
"time"

Expand All @@ -38,6 +37,7 @@ import (
"github.com/infomark-org/infomark-backend/configuration"
"github.com/infomark-org/infomark-backend/symbol"
"github.com/jmoiron/sqlx"
"github.com/markbates/pkger"
"github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -423,9 +423,7 @@ func New(db *sqlx.DB, log bool) (*chi.Mux, error) {
})
})

workDir, _ := os.Getwd()
filesDir := filepath.Join(workDir, "static")
FileServer(r, "/", http.Dir(filesDir))
FileServer(r, "/", pkger.Dir("/static"))

return r, nil
}
Expand Down
Empty file added static/.keep
Empty file.

0 comments on commit 148d541

Please sign in to comment.