Routing
Last updated
Last updated
Shipclojure uses for both frontend and backend routing because it is the fastest router in the clojure ecosystem and it is data oriented (you can represent your routes as vectors):
Fair warning: Reitit is a bit hard to grasp as first but no worries since most of the middleware and hard wiring is done for you.
Shipclojure uses for documentation, if you have your server running, visiting http://localhost:8080/api should show you the swagger documentation for all routes: api, web routes & websocket.
The routes are split into 3 categories:
REST api routes:
Websocket routes:
Frontend routes (mix of static pages rendered on the backend and frontend only routes):
How to know which frontend routes are server rendered and which are frontend only: Frontend routes will have a :view
while backend routes will have the normal syntax of :get/:post (fn [req] (render-page req))
.
Example
The shipclojure router has middleware already setup for your convenience.
See all the middleware here:
Here is the
Websockets use . Read the documentation to understand how it works.