2020-03-28 05:58:15 +03:00
|
|
|
/+ *server
|
|
|
|
:: @p request handler
|
|
|
|
::
|
|
|
|
|= [[now=@da eny=@ bek=beak] ~ ~]
|
|
|
|
|= [authorized=? =request:http]
|
|
|
|
^- simple-payload:http
|
|
|
|
=/ url=(unit pork:eyre)
|
|
|
|
(rush url.request apat:de-purl:html)
|
|
|
|
::
|
|
|
|
:: url doesn't match expected binding from :launch
|
|
|
|
::
|
2020-03-31 02:04:40 +03:00
|
|
|
?~ url
|
2020-03-28 05:58:15 +03:00
|
|
|
~| [%invalid-url url.request] !!
|
|
|
|
?. ?=([%who *] q.u.url)
|
|
|
|
~| [%unknown-url url.request] !!
|
|
|
|
::
|
|
|
|
::
|
2020-03-31 02:04:40 +03:00
|
|
|
::
|
|
|
|
?^ t.q.u.url
|
2020-03-28 05:58:15 +03:00
|
|
|
[[%404 ~] ~]
|
|
|
|
=/ response=json
|
|
|
|
(frond:enjs:format %who (ship:enjs:format p.bek))
|
2020-03-28 06:07:09 +03:00
|
|
|
:-
|
|
|
|
:- %200
|
2020-03-31 02:04:40 +03:00
|
|
|
:~ ['content-type' 'application/json']
|
|
|
|
['access-control-allow-origin' 'https://bridge.urbit.org']
|
2020-03-28 06:07:09 +03:00
|
|
|
==
|
|
|
|
`(json-to-octs response)
|