summaryrefslogtreecommitdiff
path: root/org-roam-ui.el
diff options
context:
space:
mode:
Diffstat (limited to 'org-roam-ui.el')
-rw-r--r--org-roam-ui.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/org-roam-ui.el b/org-roam-ui.el
index 3f2c737..1301627 100644
--- a/org-roam-ui.el
+++ b/org-roam-ui.el
@@ -1,6 +1,9 @@
(require 'json)
(require 'simple-httpd)
+(setq org-roam-ui/root-dir (file-name-directory load-file-name))
+(setq org-roam-ui/app-build-dir (expand-file-name "./" org-roam-ui/root-dir))
+
(define-minor-mode
org-roam-ui-mode
"Start the http API for org-roam-ui."
@@ -15,6 +18,7 @@
(t
(httpd-stop))))
+
(defservlet* graph application/json ()
(let* (
(nodes-db-rows (org-roam-db-query `[:select [*] :from nodes]))
@@ -26,6 +30,9 @@
(insert response)
(httpd-send-header t "text/plain" 200 :Access-Control-Allow-Origin "*"))))
+(httpd-def-file-servlet app org-roam-ui/app-build-dir)
+
+
(defun nodes-row-to-cons (row)
(list
(cons 'id (elt row 0))