added obsidian note api
This commit is contained in:
19
backend/handlers/handle_notes.go
Normal file
19
backend/handlers/handle_notes.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func (store *Store) GetNote(ctx *gin.Context) {
|
||||
path := ctx.Param("path")
|
||||
|
||||
note, err := store.Notes.GetNote(path)
|
||||
if err != nil {
|
||||
ctx.JSON(http.StatusNotFound, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, note)
|
||||
}
|
||||
Reference in New Issue
Block a user