hyperfiddle

http://hyperfiddle.net
miridius 2018-08-16T06:39:26.000100Z

hi @dustingetz I liked what you said about fiddle structure should model the API -- seems like I was trying to use hyperfiddle as kind of a full front end framework which I guess is not the intention (yet?). So what would make more sense is to use it as the DB layer and the API layer, as well as for testing/visualising/prototyping the API with fiddles, and for all the "admin" pages for administering data and so on which are not visible to the public and don't need to be fancy. And then a separate, "fancy", end user client web app can be built in front of that, which calls the API when it needs data. What do you think? Is there anywhere that I can see how to use the API externally? Or should I just have a look at the network tab of developer tools and figure it out that way?

2018-08-16T11:59:02.000100Z

@miridius The "fancy" version can be done hyperfiddle for quite a while (through the MVP stage, at least). I would just tone it down a little – don't make fiddles that hold only a clojurescript function. An common idiom is: `(let [{:keys [:hypercrud.browser/data]} @(hyperfiddle.data/browse+ ctx :iframe "account")] [:pre (pr-str @data)])`

miridius 2018-08-16T12:08:42.000100Z

I don't really get what that code is doing - does hyperfiddle.data/browse+ make an API call?

2018-08-16T12:19:55.000100Z

@miridius Since it's an iframe the data is already on the page (e.g. toggle API view to confirm this). hyperfiddle.data/browse+ is symmetrical with hyperfiddle.ui/browse, except instead of rendering the child fiddle, it just returns the ctx/data directly, for the parent to render

2018-08-16T12:20:30.000100Z

:iframe is a link/rel and "account" is a link/class

miridius 2018-08-16T12:25:30.000100Z

@dustingetz can I delete fiddles?

2018-08-16T12:25:47.000100Z

@miridus Yes but the remove fiddle button is broken today 🙂

miridius 2018-08-16T12:25:54.000200Z

haha ok

miridius 2018-08-16T12:26:42.000100Z

I'll just rename them to something like :deleteme/<name> in the interim

2018-08-16T12:27:02.000100Z

You can stage [:db/retractEntity :fiddleident] directly

miridius 2018-08-16T12:31:08.000100Z

ah thanks

2018-08-16T12:57:22.000100Z

Refresh, i added more

miridius 2018-08-16T12:57:40.000100Z

nice!

2018-08-16T12:57:56.000100Z

Does this help answer your questions, or am I missing the point?

miridius 2018-08-16T13:00:57.000100Z

ok yeah that's pretty awesome if I'm building everything in hyperfiddle. But my question was around how can I call the APIs externally? Or are you saying that the best way to do that would be to use the hyperfiddle jar in my external program?

2018-08-16T13:03:17.000100Z

To do that today you'd compile against hyperfiddle.jar, adding a deploy cycle etc

2018-08-16T13:03:42.000100Z

You could of course hit the API directly, but now you have to write network code, async and error handling etc

miridius 2018-08-16T13:15:12.000100Z

gotcha

miridius 2018-08-16T13:15:28.000100Z

yeah much easier to use the jar

khardenstine 2018-08-16T15:55:19.000100Z

[:db/retractEntity [:fiddle/ident :your-fiddle-ident]]