Fork me on GitHub
#fulcro
<
2017-11-23
>
tony.kay02:11:08

Colin F. has been nice enough to agree to make Cursive better understand a few of our critical macros as well šŸ™‚

fatihict13:11:12

OMG! Just tried Fulcro-inspect with @mitchelkuijpers and @timovanderkamp

fatihict13:11:25

Very impressive stuff @wilkerlucio

timovanderkamp13:11:14

This. Is. Amazing.

wilkerlucio15:11:11

@fatihict @timovanderkamp thanks for trying that out, I hope we can make it even better with time šŸ™‚

uwo16:11:59

(continuing a conversation from elsewhere) Would it be possible to plug in just the fulcro.server/api-handler into an already existing ring stack, forgoing the Stuart Sierra component dependency?

uwo16:11:25

(Iā€™m looking to migrate an already existing, old project to fulcro)

tony.kay16:11:09

So, Iā€™m not sure you can easily drop the dependency. It isnā€™t that hard to write a server in whatever way you like, but you do want to keep a bit of the server-side plumbing around.

tony.kay16:11:19

let me look for a momentā€¦

tony.kay16:11:55

So, there is going to be a compile-time dependencyā€¦but not sure why that would be a problem. The tree for component is relatively small.

uwo16:11:45

totally, Iā€™m amenable to that. I mostly want to limit the surface area of change to the existing server code

tony.kay16:11:01

right, but you do use Ring?

tony.kay16:11:47

ok, two approaches. The first is to hack in the middleware from the modular server, as shown in the devguide.

tony.kay16:11:15

The other is to read the easy-server namespace, understand how it is assembled (it really isnā€™t that much), and mimic that.

tony.kay16:11:43

The pre-written code is trying to do a few things to make your life easier (and make it possible for you to use future full-stack libraries), but the bits you need are relatively small

tony.kay16:11:01

if all you want is api handling

tony.kay16:11:40

That said, if you donā€™t use the modular server, then you will be making your life possibly harder down the road when something like a cool Fulcro file browser comes out and includes a modular plug-in for the server.

uwo16:11:22

Makes sense. When you say to hack the middleware from the modular server, do you just mean to simply use the approach taken there?

tony.kay16:11:49

The modular server can compose parsers, and provides a public standard API for doing so

tony.kay16:11:10

so I can write a server-side module that you can drop into your server, and it can add itā€™s own parser to handle the requests.

tony.kay16:11:48

embed that in your Ring handler.

tony.kay16:11:08

youā€™ll need to generate the parsing env (e.g. embed Datomic connection in it or whatever)

tony.kay16:11:56

You should probably use the fulcro.server/fulcro-parser, since it supports the macros that are described in the guide

uwo16:11:03

Great. Thanks for the help!

tony.kay16:11:10

Yes, it is a short functionā€¦it really doesnā€™t take much šŸ™‚ I think this is the complete list: - You need transit and transit-params - The augment-map stuff allows you to mess with the response from your mutation/query handlers (see dev guide) - query is literally the raw incoming EDN from the app - Youā€™re responsible for putting stuff in env. It is your serverā€™s env. Most of the complexity in my code is around getting that stuff started and integrated into env on every request - raise-response deals with the fact that the parser returns a map like {:result ... :tempids ...} for each mutation, for exampleā€¦it combines them all together

uwo16:11:04

I may just take the modular server approach, given the benefit of the plug-in architecture šŸ™‚

tony.kay16:11:05

so parse, raise, merge with augmented response stuff

tony.kay16:11:20

So, just so you know, the plug-in arch isnā€™t used much yetā€¦.and it was written before the standard fulcro-parser. The other way for a library author to integrate would be to require you to use that parserā€¦at which point it wouldnā€™t matterā€¦theyā€™d just namespace their queries/mutations. Iā€™m feeling like this might be the better approach now šŸ™‚

tony.kay16:11:34

not sure. have not thought about it enough.

tony.kay16:11:14

Wilkerā€™s pathom library is potentially disruptive hereā€¦there are compelling reasons not to use the built-in parser

tony.kay16:11:17

Either way, most of the ā€œseriousā€ plumbing is on the client side

tony.kay17:11:02

Iā€™m working on the dev guide, so perhaps Iā€™ll revise it to first show easy server for getting started, then stress how to build your own server ā€œfrom scratchā€, then mention modular server.

uwo17:11:29

I think that would be great for people who are trying to migrate

tony.kay17:11:56

sure, agreedā€¦working on it right now

tony.kay17:11:15

I was just editing those portions of the dev guide, so timely question

uwo17:11:58

so, sorry if being dense here, youā€™re saying I can just use handle-api-request directly, no? Anything else besides resource injects that I need to ensure is in the env? Iā€™m embarrassed to say that we currently just close over the datomic connection lol

tony.kay17:11:34

So, if Datomic is all you need, that is safe to do. I have not specifically tried just calling that, but I think thatā€™s right. itā€™ll be in the docs on the 2.0 branch later today, once I have šŸ™‚ If youā€™ve made sure the request was for ā€œ/apiā€, then yes, that looks correct

uwo17:11:45

gotta run, late for the family meal. thanks again!!

tony.kay17:11:37

There ya go. Fully tested and documented. šŸ™‚

tony.kay17:11:44

OKā€¦on to the cooking of food! American eat-yourself-into-a-coma day!

tony.kay17:11:50

šŸ¦ƒ šŸ° šŸ  (whereā€™s the frigging pie emoticon???)

sova-soars-the-sora19:11:01

Oh this is where y'all went šŸ™‚

sova-soars-the-sora19:11:03

@daniel.dyba https://github.com/fulcrologic/fulcro is a library using om.next ... also this channel is a good place to ask for om.next stuff

roklenarcic20:11:03

The only thing I'm afraid of in this whole endeavour is that in large applications the denormalized tree might get too large. If you have a bunch of idents in db that point to large objects, the denormalized form might get huge. This applies to client db, but also to returns from reads. Instead of returning 10 people and 1000 transactions that reference those 10 people by id over and over, I have to return the expanded form and that might get large. Though zipping will probably help a lot with that.

tony.kay20:11:18

@roklenarcic you donā€™t have to normalize everything. But ā€œtoo largeā€ is unlikely to be a problem. Browser memory might be a limit (but would be if you loaded all of it in any app, so you do have to manage things responsibly) The data structures in cljs are very very fast.

tony.kay20:11:54

@sova Fulcro 1.0 uses Om Next underneath, and 2.0 is an api-compatible library of it;s own. In this channel, we recommend using Fulcro, of course

tony.kay20:11:11

That said, all of the concepts of Om Next are useful in Fulcro

tony.kay20:11:55

Please check out the docs/videos/demos via the website as well (which is in the subject of this channel)

sova-soars-the-sora22:11:04

@tony.kay wonderful. thanks for the update šŸ˜ƒ

sova-soars-the-sora22:11:14

right now i am learning Rum, and it is going very well.

sova-soars-the-sora22:11:39

Does fulcro support Serverside rendering ?

sova-soars-the-sora22:11:57

that is one thing I tried really hard to get working on om.next without much mark'ed success.

wilkerlucio22:11:35

@sova yes, Fulcro supports SSR, the template already comes with that out of the box

sova-soars-the-sora22:11:51

Thanks for answering my questions šŸ™‚ I am also curious: is there a login form with validation / session setting out of the box, too?

j1mr10rd4n00:11:25

contains example with SSR, sessions and an example user db with log in/out and registration