Skip to content

Latest commit

 

History

History
105 lines (74 loc) · 1.91 KB

README.md

File metadata and controls

105 lines (74 loc) · 1.91 KB

Friends Graph

A simple demo using fulcro, pathom and crux

Running (for clj devs)

Install npm deps

$ npm install

Start a REPL with dev profile

$ clj -A:dev

Call (user/-main) function. Wait the shadow-cljs build

Connect at localhost:8080

Running (for js devs)

Install npm deps

$ npm install

Start shadow-cljs via npm

$ npm start

Connect at localhost:8080

Running "production" jar

Install npm deps

$ npm install

Generate uberjar

$ lein uberjar

And run

java -jar target/graph-demo.jar

Connect at localhost:8080

React native (not working)

After get the web up'n'running, start the metro server

npm run rn-server

Then launch the app on emulator/app.

npm run rn-android

Hacking

src/
├── dev
│   └── user.clj ## dev helper
└── main
    └── souenzzo
        └── graph_demo
            ├── client.cljs   ## fulcro sutff
            └── core.clj      ## http, pathom and crux stuff
deps.edn                      ## clj deps
package.json                  ## js deps

Fulcro components generate a query like this

[{[:user/id "foo"]  [:user/id
                     :user/color
                     {:user/friends [:user/id 
                                     :user/color 
                                     {:user/friends [:user/id]}]}]}] 

Patohom resolver souenzzo.graph-demo.core/friends (bad name) will get "foo", turn into :user.id/foo, get the entity from crux, usually something like {:crux.db/id "foo" :user/friends [:user.id/var]} and return {:user/friends [{:user/id "bar"}]}

Pathom will flow the query recursively.