So let's get started with plans by creating a stub page and a stub handler.
And what I'll do is start in my roots and create a new route right here below my one for the widgets.
And I'll create a route that points to a handler that doesn't exist yet.
Ruxton get and I'll call the route slash plans.
And in the name of my plan, which would be Brons in this case because.
Because that's the only plan we have and that will point to app dot bronze plan handler.
That doesn't exist yet, but we'll create that right now.
So let's go over to handlers and scroll to the very bottom or create a new handler here, func with
the receiver app pointer to application type and we'll call it bronze plan and it will take a response.
Reader response writer.
And a pointed to a request.
And we need to pass this handler the idea of the plan, because ultimately we'll look up the plans from
the database and render the page accordingly.
So I'm going to pass that information to my template using the intermap, which is part of the kinds
of information we can pass to templates.
And it's just a map with an index of string and the contents are and then we'll populate that with an
idea of one just for now, just so we can get this to compile in map and the plan ID will be equal to
one.
And now we'll just call our template render function, which will render a template that doesn't exist
yet, but we'll make that in a moment.
So if error is assigned, the value of APTA render template and it requires the response rate, I request
the name of the plant, the template, which we call bronze plan, and then we'll pass some template
here and we'll we'll pass it is the map with our map which is created.
Ultimately it will require some JavaScript as well, but I'm not going to worry about that right now.
So we'll simply close that off, check for an error
and we'll just print the error.
OK, now let's go create our template, so with our templates folder, inside the Web folder, inside
the CMD folder, or create a new template called Brons Dash Plan Page Dot, go e-mail.
And for right now, we'll make this a simple setup.
So we use our base template and hand it data and we'll give it a title
and we'll just call that bronze plan.
Close off the title, and for now, the content will just be simple just so we can make sure everything
works, we'll just put in H2 in there the class of, say, margin top five, bronze plan close to two.
And I'll put a horizontal rule in there as well.
OK, so if we get everything right, I should be able to type, make run or make start, I guess is.
And let's go to our base template and make sure that links to the correct place.
So subscription is no longer a link to just the hash, it now goes to plans ignorants, which means
I actually need to restart my application.
So let's open our terminal, make stuff like start.
Now let's go back to our Web browser, reload this page.
Go to our products menu and choose subscription and see if we got it right and we did.
OK, so the next step is to start working on the JavaScript, which will be different than the JavaScript
for buying a single widget, because now we're having people purchase a subscription, a recurring monthly
payment, and we'll get started on that in the next election.