Skip to content

Commit

Permalink
fix: tpl render error (#646)
Browse files Browse the repository at this point in the history
* fix: render error
* mod: remove
  • Loading branch information
hetao92 authored Sep 19, 2023
1 parent 10b92be commit 71b089d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
6 changes: 1 addition & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
<!-- Global Event Tracking -->
<script>var global = typeof global !== 'undefined' ? global : window;</script>
<script>
<% if (initProps.NODE_ENV === 'development') { %>
window.gConfig = { databaseName: "NebulaGraph" }
<% } else { %>
window.gConfig = { databaseName: "NebulaGraph" }
<% } %>
window.gConfig = { databaseName: "NebulaGraph" }
</script>
<style>
@-webkit-keyframes square-spin {
Expand Down
16 changes: 0 additions & 16 deletions server/api/studio/pkg/middleware/file.go
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
package utils

import (
"html/template"
"io/fs"
"net/http"
"path/filepath"

"github.com/vesoft-inc/go-pkg/middleware"
"github.com/vesoft-inc/nebula-studio/server/api/studio/internal/svc"
"github.com/vesoft-inc/nebula-studio/server/api/studio/pkg/ecode"
"github.com/vesoft-inc/nebula-studio/server/api/studio/pkg/utils"
)

func AssetsMiddlewareWithCtx(svcCtx *svc.ServiceContext, embedAssets fs.FS) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if filepath.Ext(r.URL.Path) == "" {
_, err := template.ParseFS(embedAssets, "assets/index.html")
withErrorMessage := utils.ErrMsgWithLogger(r.Context())
if err != nil {
svcCtx.ResponseHandler.Handle(w, r, nil, withErrorMessage(ecode.ErrInternalServer, err))
return
}

w.Header().Set("Content-Type", "text/html")
w.WriteHeader(http.StatusOK)
return
}

handler := middleware.NewAssetsHandler(middleware.AssetsConfig{
Root: "assets",
Expand Down

0 comments on commit 71b089d

Please sign in to comment.