mirror of
https://github.com/fumiama/paper-manager.git
synced 2026-07-02 08:40:26 +08:00
优化后端文件组织架构
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package api
|
package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package api
|
package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package api
|
package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package api
|
package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package api
|
package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package api
|
package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
8
main.go
8
main.go
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/fumiama/paper-manager/backend/api"
|
"github.com/fumiama/paper-manager/backend"
|
||||||
)
|
)
|
||||||
|
|
||||||
func line() int {
|
func line() int {
|
||||||
@@ -29,9 +29,9 @@ func main() {
|
|||||||
os.Exit(line())
|
os.Exit(line())
|
||||||
}
|
}
|
||||||
|
|
||||||
http.HandleFunc("/api/", api.Handler)
|
http.HandleFunc("/api/", backend.Handler)
|
||||||
http.HandleFunc("/file/", api.FileHandler)
|
http.HandleFunc("/file/", backend.FileHandler)
|
||||||
http.HandleFunc("/upload", api.UploadHandler)
|
http.HandleFunc("/upload", backend.UploadHandler)
|
||||||
|
|
||||||
logrus.Infoln("[http.Serve] start at", l.Addr())
|
logrus.Infoln("[http.Serve] start at", l.Addr())
|
||||||
logrus.Errorln("[http.Serve]", http.Serve(l, nil))
|
logrus.Errorln("[http.Serve]", http.Serve(l, nil))
|
||||||
|
|||||||
Reference in New Issue
Block a user