This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-23
Channels
- # aws (2)
- # beginners (57)
- # boot (63)
- # cider (7)
- # clara (1)
- # cljs-dev (1)
- # cljsrn (5)
- # clojure (68)
- # clojure-brasil (1)
- # clojure-dusseldorf (2)
- # clojure-greece (10)
- # clojure-italy (29)
- # clojure-russia (1)
- # clojure-spec (9)
- # clojure-uk (66)
- # clojurescript (16)
- # cursive (18)
- # datomic (19)
- # docker (3)
- # figwheel (2)
- # fulcro (61)
- # instaparse (7)
- # jobs (1)
- # luminus (5)
- # lumo (47)
- # mount (6)
- # off-topic (13)
- # onyx (39)
- # planck (4)
- # portkey (2)
- # re-frame (28)
- # ring (6)
- # ring-swagger (30)
- # rum (3)
- # shadow-cljs (142)
- # spacemacs (5)
- # sql (2)
- # unrepl (61)
- # untangled (2)
Colin F. has been nice enough to agree to make Cursive better understand a few of our critical macros as well š
OMG! Just tried Fulcro-inspect with @mitchelkuijpers and @timovanderkamp
Very impressive stuff @wilkerlucio
This. Is. Amazing.
@fatihict @timovanderkamp thanks for trying that out, I hope we can make it even better with time š
(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?
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.
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.
totally, Iām amenable to that. I mostly want to limit the surface area of change to the existing server code
ok, two approaches. The first is to hack in the middleware from the modular server, as shown in the devguide.
The other is to read the easy-server namespace, understand how it is assembled (it really isnāt that much), and mimic that.
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
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.
Makes sense. When you say to hack the middleware from the modular server, do you just mean to simply use the approach taken there?
The modular server can compose parsers, and provides a public standard API for doing so
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.
So, this is your primary task: https://github.com/fulcrologic/fulcro/blob/1.2.0/src/main/fulcro/server.clj#L354
youāll need to generate the parsing env
(e.g. embed Datomic connection in it or whatever)
You should probably use the fulcro.server/fulcro-parser
, since it supports the macros that are described in the guide
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
I may just take the modular server approach, given the benefit of the plug-in architecture š
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 š
Wilkerās pathom library is potentially disruptive hereā¦there are compelling reasons not to use the built-in parser
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.
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
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
@uwo https://github.com/fulcrologic/fulcro/blob/2.0/src/devguide/fulcro_devguide/I_Building_A_Server.cljs#L22
and it does really boil down to this one line of code: https://github.com/fulcrologic/fulcro/blob/2.0/src/devguide/solutions/tiny_server.clj#L22
Oh this is where y'all went š
@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
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.
we shall see
@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.
@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
Please check out the docs/videos/demos via the website as well (which is in the subject of this channel)
@tony.kay wonderful. thanks for the update š
right now i am learning Rum, and it is going very well.
Does fulcro support Serverside rendering ?
that is one thing I tried really hard to get working on om.next without much mark'ed success.
@sova yes, Fulcro supports SSR, the template already comes with that out of the box
Thanks for answering my questions š I am also curious: is there a login form with validation / session setting out of the box, too?
contains example with SSR, sessions and an example user db with log in/out and registration