summaryrefslogtreecommitdiff
path: root/app/neyre.hoon
diff options
context:
space:
mode:
Diffstat (limited to 'app/neyre.hoon')
-rw-r--r--app/neyre.hoon81
1 files changed, 81 insertions, 0 deletions
diff --git a/app/neyre.hoon b/app/neyre.hoon
new file mode 100644
index 0000000..e8f2c17
--- /dev/null
+++ b/app/neyre.hoon
@@ -0,0 +1,81 @@
+/- *neyre, coki
+/+ dbug, cokil=coki
+/= router /web/router
+=| sessions:coki
+=* sessions -
+=| versioned-state
+=* state -
+%- agent:dbug
+^- agent:gall
+|_ =bowl:gall
++* this .
+ cokilib ~(. cokil [sessions bowl])
+++ on-init
+ ^- (quip card:agent:gall agent:gall)
+ :_ this
+ =/ weblib router(bowl bowl)
+ =/ weblib2 weblib(base-path /)
+ :~ (eyre-binding-card:weblib2 /)
+ (eyre-binding-card:weblib2 /[dap.bowl])
+ ==
+::
+++ on-save
+ ^- vase
+ !>(state)
+::
+++ on-load
+ |~ old-state=vase
+ ^- (quip card:agent:gall agent:gall)
+ =/ vs !<(versioned-state old-state)
+ ~& vs=vs
+ =. state
+ ?- -.vs
+ %0 vs
+ ==
+ `this
+::
+++ on-poke
+ |= [=mark =vase]
+ ^- (quip card:agent:gall agent:gall)
+ ?+ mark `this
+ %coki =^ cards sessions (handle-self-poke:cokilib !<(self-poke:coki vase))
+ [cards this]
+ %handle-http-request
+ ~& "handling http"
+ =/ order !<([id=@ta req=inbound-request:eyre] vase)
+ =/ weblib ~(. router [bowl id.order req.order state sessions])
+ =/ weblib2 weblib(base-path /)
+ :- route:weblib2 this
+ %noun ~& > s=sessions `this
+ ==
+::
+++ on-watch
+ |~ path
+ ^- (quip card:agent:gall agent:gall)
+ `this
+::
+++ on-leave
+ |~ path
+ ^- (quip card:agent:gall agent:gall)
+ `this
+::
+++ on-peek
+ |~ path
+ ^- (unit (unit cage))
+ ~
+::
+++ on-agent
+ |~ [wire sign:agent:gall]
+ ^- (quip card:agent:gall agent:gall)
+ `this
+::
+++ on-arvo
+ |~ [wire =sign-arvo]
+ ^- (quip card:agent:gall agent:gall)
+ `this
+::
+++ on-fail
+ |~ [term tang]
+ ^- (quip card:agent:gall agent:gall)
+ `this
+--