I set up a mean stack based on http://mean.io
I managed to get it running but I'm confused with the user authentication flow.
The main thing that is confusing me is the distinction between server/views and public/views.
I understand that when I want to require user auth I can do app.get
with auth.requiresLogin
.
But how does this mix in with the angular client side of things? How do I make the angular views available only when logged in.
My objective is to have the following:
When users go to /
I want them to see a basic message if they are not logged in.
When they do log in, in /
I want them to see my angular app.
I'm confused as to how to achieve that.
How do I structure my app for this purpose? Can I check in the template whether a user is logged in?
You use
routeProvider
:This example has to work.