So we have this menu for admin users set up and we have references to admin, all Desh sales for all
sales and slash admin, all dash subscriptions for all subscriptions.
And we also have the virtual terminal.
Now, the virtual terminal is there and it works fine.
But of course, we need to set up the routes and handlers and templates for these two links.
And we can also, because I forgot to do it last time, get rid of this, which nobody sees because
it has the class of Denon but is just cluttering up our base layout.
So I'll delete that.
And the other thing I want to take care of, and this has been bothering me for a while and we just
something left over from when I began planning this course is in the render dot go package.
If you get down to the page where we actually render things down here, what we pass the template.
Where is it?
Right here.
So this if statement, OK, and this is in the function render template.
I actually have if app dot config one of equals production and template in map.
And this is because initially when I did this I wasn't using going back, I had my templates in a separate
folder, but then I thought, no, let's take advantage of the new go embed functionality and put our
templates right into a file system.
That's part of the binary that we see when we run this application or we compile this application.
And of course, the go embed gives us a read only file system.
So this check actually doesn't make any sense.
So we can get rid of this part right here and just make it simpler.
Now, if the template is in the map, we use the template from the map, from the app template cache.
Otherwise we pass the template and actually put it in the map a little bit further down, right down
here in the pass template function.
We added to the map right there on line 106 and my code.
So that's just a bit of housecleaning.
And we were going to do some more housekeeping a little bit later on.
But right now, let's get some stub routes and handlers set up for those two pages, all sales and all
subscriptions.
So the first thing to do is create the templates we're going to need.
So in my templates folder, I'll create a new file and I'll call the first one all Desh sales page and
go HTML.
And I call the second one new file, all Dasht subscriptions.
Page Dot Go HTML.
And we'll just put Stobbs in here for right now, so we'll start with all subscriptions and of course,
it's using our template base and we'll be handing data to this and we'll define the title.
And we'll call this all subscriptions.
And that will have some content defined content, and for now I'm just going to say to class equals
empty dash five, all subscriptions.
And close my age to put an HRR in there and close this, and we're also going to have JavaScript.
Saw just out the block right now and leave it empty.
Now, a copy all of this and go to all sales, all their sales page to go with HTML and just change
this to sales just so we can render something and make sure everything is hooked up properly.
Now let's go to our roots in the CMD Web folder and up here where we have the admin part.
And I'm going to delete these now because they've been there long enough, that comment into that line.
I'll create two new routes.
So the first one is going to be a we'll just duplicate that amongst doGet and it's going to go admin,
which again, we get from this line line 15 and it's all dash sales and it will go to a handler that
doesn't exist yet, all sales.
And then I'll duplicate that and change this to subscriptions.
Which I better spell right script shuns there.
Now let's go over to our handlers and I'll just get there by clicking on a virtual terminal and scroll
the very bottom and we'll put two stub handlers in place.
Very simple ones.
So I'll have a function with the receiver of App Pointer to application.
And this one is going to be called All Sales and as a handler.
So it has the response writer and the request.
And I'll copy this.
I shall finish it first or copy this part.
Right.
And we find a render so I can save some time right here.
I copy that one from forgot password and paste it in here and just change this part to all dash sales.
We'll have to modify these in a while, of course, but this will get us running and make sure that
everything is hooked up properly.
Paste that in there and changes to also descriptions and change sales to subscriptions here.
Now, I should be able to run this and see those pages.
So let's make stop make a start and just go back and make sure that everything works as it should.
So back to my Web browser.
I appear to be logged in, but I'm going to log out.
No, I'm not logged in.
So let's log in and go to admin at example, dot com password three and log in.
And there's my admin menu and I should be able to go to all sales.
They're there and all subscriptions.
And there it is.
So next step is to actually write some JavaScript on both of those pages that we'll call the back end
using our authentication token so we can pass muster and show them that we are, in fact authenticated
and request a list of all subscriptions or all sales and display them in tabular format.
And we'll get started on that in the next lecture.