Skip to content

Instantly share code, notes, and snippets.

@langford
Created June 11, 2015 05:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save langford/7803283e9a232f5e85ef to your computer and use it in GitHub Desktop.
Save langford/7803283e9a232f5e85ef to your computer and use it in GitHub Desktop.
Clojure Meetup on 6/9
Introduction to Pedestal --- They finally had a recruiter.
Rentpath is looking for a senior clojure and senior ruby
CareerBuilder is looking for a clojure person. They're moving a lot of stuff to clojure.
Stuart Hinson, asked about familiarity with Ring, works at RentPath
Aims to be simple.
They ripped out the clojurescript stuff cause react is cool yo
Currently ring ties a thread up until it's done with the request, you eventually need to collect your core async if nothing else to do the response
Interceptors handle all the middleware: Routing, errors, middleware, etc
Increases our thread consumption, so eventually runs out on the JVM
Why not Pedestal:
Currently doesn't do websockets
Less familiar than Rings
Can't share routing between client and server (for CLJs)
service.clj is the data def of the app (routes, etc)
server.clj is the service
Execute takes a context map, which is...the context of data about it, including a queue of interceptors
In enter, we transform the context through all the inteterceptor's enter functions, and apply the contexts through a stack, does the handle, then pops them off transforming the requests through backwards, as a stack would
Buuuut, if we yield a channel, it throws out the old thread, and makes a go thread. Letting you swap between them between async and sync
Having interceptors as data gives lets them play with metadata a bit easier during auth
They use this functionality at RP to make a browser repl,
stlyeobate is hardcoded in pedestal, serverlet/ring interface info
Routing interceptor primarily makes new interceptors on a request based on the map
Primarily use the enter if you only have one way directionality, just return a response map
It does a lot of the fuzzy thread pool stuff
Pedestal does swagger some stuff that ring-swagger was not good enough to do for async stuff
Interceptors are not used for everything, we also use get and put items
They use Enlive to append the script tag, then the start the browser repl
He has a blogpost about how the browser REPL works: Stuarth.github.io
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment