-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.osl
More file actions
50 lines (38 loc) · 1.19 KB
/
main.osl
File metadata and controls
50 lines (38 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import "net/http"
import "sync"
import "errors"
import "path"
import "net/url"
import "context"
import "crypto/md5"
import "encoding/hex"
import "./middleware.osl"
import "./handlers.osl"
import "./notes.osl"
import "./utils.osl"
import "./pages.osl"
import "./originFSKit.go"
import "github.com/gin-gonic/gin"
object clients = {}
string notesDir = "/application data/notes@rotur"
def main() (
auto r = gin.Default()
r.LoadHTMLGlob("templates/*")
r.Static("/static", "./static")
r.GET("/", homePage)
r.GET("/auth", authPage)
r.GET("/storage", storagePage)
r.POST("/logout", handleLogout)
auto api = r.Group("/api")
api.GET("/health", handleHealth)
api.GET("/notes", requireAuth, handleListNotes)
api.GET("/notes/all", requireAuth, handleGetAllNotesWithContent)
api.POST("/note", requireAuth, handleCreateNote)
api.DELETE("/note", requireAuth, handleDeleteNote)
api.PUT("/note", requireAuth, handleRenameNote)
api.GET("/note", requireAuth, handleReadNote)
api.PUT("/tags", requireAuth, handleUpdateTags)
api.GET("/tags", requireAuth, handleGetAllTags)
api.GET("/notes/filter", requireAuth, handleFilterNotesByTags)
r.Run(":5608")
)