Remix Fundamentals

Admin User Exercise

Kent C. Dodds

Kent C. Dodds

Professional Trainer
Remix Fundamentals

Check out a free preview of the full Remix Fundamentals course

The "Admin User Exercise" Lesson is part of the full, Remix Fundamentals course featured in this preview video. Here's what you'd learn in this lesson:

Students are instructed to create an abstraction to protect every route under /posts/admin. This abstraction should apply to both loader and action functions.

Preview
Close

Transcript from the "Admin User Exercise" Lesson

[00:00:00]
>> Let's go on to Exercise 10, the last exercise of our day. We're gonna note Dev 10 and that should be on 4010. As mentioned, the ND stack sets up authentication for you. And you're more than welcome to dive into the user model to see how some of the user creation and password management stuff works.

[00:00:28]
As well as this session dot server which we actually will be modifying to see how some of that all works, but we are just going to use what was generated for us in this project and enhance it so that we can protect some of our admin only routes.

[00:00:46]
So if you open up the readme that will give some background on protected routes and things like that, some explanation on loaders and actions and the way that they run concurrently. And then, I give an example of how to do a little bit of protected routes. And, we actually get into throwing responses and why that makes this so awesome.

[00:01:10]
So you can take a look at that, and then our exercise we want to protect all the routes under post admin, so users should not be able to get to those routes or perform any actions on those routes. And then in the extra credit, we're also going to hide any links that take users over there.

[00:01:28]
So, we're talking about the server side which is where you want to put the prediction like you have to have it there, and then we'll talk about the client side to enhance the users experience by not sharing them links they can't go to. So, that is what we're doing and I hope you have an amazing time doing it.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now