Skip to content

Commit

Permalink
refactor: use React as frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed Aug 21, 2022
1 parent b188e93 commit 094d1e4
Show file tree
Hide file tree
Showing 34 changed files with 62 additions and 2,076 deletions.
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
# React Template
# Gin React Template

## Basic Usages
```shell
# Runs the app in the development mode
npm start

# Builds the app for production to the `build` folder
npm run build
```

## Reference
https://github.com/OIerDb-ng/OIerDb
4 changes: 0 additions & 4 deletions common/constants.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package common

import (
"embed"
"flag"
"fmt"
"github.com/google/uuid"
Expand Down Expand Up @@ -66,9 +65,6 @@ var ExplorerRootPath = UploadPath
var ImageUploadPath = "upload/images"
var VideoServePath = "upload"

//go:embed public
var FS embed.FS

var SessionSecret = uuid.New().String()

var SQLitePath = ".gin-react-template.db"
Expand Down
32 changes: 32 additions & 0 deletions common/embed-file-system.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package common

import (
"embed"
"github.com/gin-gonic/contrib/static"
"io/fs"
"net/http"
)

// Credit: https://github.com/gin-contrib/static/issues/19

type embedFileSystem struct {
http.FileSystem
}

func (e embedFileSystem) Exists(prefix string, path string) bool {
_, err := e.Open(path)
if err != nil {
return false
}
return true
}

func EmbedFolder(fsEmbed embed.FS, targetPath string) static.ServeFileSystem {
efs, err := fs.Sub(fsEmbed, targetPath)
if err != nil {
panic(err)
}
return embedFileSystem{
FileSystem: http.FS(efs),
}
}
23 changes: 0 additions & 23 deletions common/public/404.html

This file was deleted.

23 changes: 0 additions & 23 deletions common/public/error.html

This file was deleted.

89 changes: 0 additions & 89 deletions common/public/explorer.html

This file was deleted.

14 changes: 0 additions & 14 deletions common/public/footer.html

This file was deleted.

13 changes: 0 additions & 13 deletions common/public/header.html

This file was deleted.

68 changes: 0 additions & 68 deletions common/public/help.html

This file was deleted.

65 changes: 0 additions & 65 deletions common/public/image.html

This file was deleted.

Loading

0 comments on commit 094d1e4

Please sign in to comment.