feat(build): add fmt/lint/test tasks
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"io/fs"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"encoding/base64"
|
||||
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"git.madunde.ad/madundead/obi/routers"
|
||||
"obi/routers"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -31,9 +31,9 @@ func main() {
|
||||
|
||||
router.GET("/api/v1/files/:id", func(c *gin.Context) {
|
||||
id := c.Params.ByName("id")
|
||||
path, _ := base64.StdEncoding.DecodeString(id)
|
||||
path, _ := base64.StdEncoding.DecodeString(id)
|
||||
|
||||
data, _ := os.ReadFile(string(path))
|
||||
data, _ := os.ReadFile(string(path))
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"data": string(data)})
|
||||
})
|
||||
@@ -58,6 +58,7 @@ func listFiles(dir string) []string {
|
||||
}
|
||||
return files
|
||||
}
|
||||
|
||||
//
|
||||
// func readFile(string filePath) []string {
|
||||
// content, err := os.ReadFile(filePath)
|
||||
|
||||
Reference in New Issue
Block a user