Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redirect users to a different page if they aren't logged in? (ring/compojure)

what's the best way to route to one page if the user is signed in (i.e. session has a non-nil value for the user-id key) and another if the user is not signed in? The ideal would be 2 different set of routes.

Thanks!

Also, are there any good example apps using compojure out there?

like image 636
hurshagrawal Avatar asked May 18 '13 01:05

hurshagrawal


1 Answers

Ok, so figured this out. Routes in compojure are composable, so you can take a defroutes handlers and feed it to another defroutes handler.

http://vedang.me/techlog/2015/8/21/composability-and-compojure has a great explanation.

like image 108
hurshagrawal Avatar answered Sep 28 '22 01:09

hurshagrawal