WEBVTT 00:01.830 --> 00:06.570 So let's get started with plans by creating a stub page and a stub handler. 00:06.610 --> 00:12.990 And what I'll do is start in my roots and create a new route right here below my one for the widgets. 00:13.560 --> 00:16.470 And I'll create a route that points to a handler that doesn't exist yet. 00:16.690 --> 00:20.040 Ruxton get and I'll call the route slash plans. 00:20.040 --> 00:23.380 And in the name of my plan, which would be Brons in this case because. 00:23.550 --> 00:29.220 Because that's the only plan we have and that will point to app dot bronze plan handler. 00:29.220 --> 00:31.820 That doesn't exist yet, but we'll create that right now. 00:33.000 --> 00:41.680 So let's go over to handlers and scroll to the very bottom or create a new handler here, func with 00:41.680 --> 00:50.120 the receiver app pointer to application type and we'll call it bronze plan and it will take a response. 00:50.130 --> 00:52.380 Reader response writer. 00:55.510 --> 00:56.890 And a pointed to a request. 01:02.760 --> 01:08.700 And we need to pass this handler the idea of the plan, because ultimately we'll look up the plans from 01:08.700 --> 01:10.830 the database and render the page accordingly. 01:11.340 --> 01:17.220 So I'm going to pass that information to my template using the intermap, which is part of the kinds 01:17.220 --> 01:19.290 of information we can pass to templates. 01:19.500 --> 01:29.910 And it's just a map with an index of string and the contents are and then we'll populate that with an 01:29.910 --> 01:38.670 idea of one just for now, just so we can get this to compile in map and the plan ID will be equal to 01:38.670 --> 01:38.940 one. 01:41.360 --> 01:46.310 And now we'll just call our template render function, which will render a template that doesn't exist 01:46.310 --> 01:47.510 yet, but we'll make that in a moment. 01:48.020 --> 01:56.630 So if error is assigned, the value of APTA render template and it requires the response rate, I request 01:57.080 --> 02:04.000 the name of the plant, the template, which we call bronze plan, and then we'll pass some template 02:04.010 --> 02:11.660 here and we'll we'll pass it is the map with our map which is created. 02:13.690 --> 02:17.990 Ultimately it will require some JavaScript as well, but I'm not going to worry about that right now. 02:18.920 --> 02:23.750 So we'll simply close that off, check for an error 02:30.770 --> 02:31.910 and we'll just print the error. 02:33.630 --> 02:38.550 OK, now let's go create our template, so with our templates folder, inside the Web folder, inside 02:38.550 --> 02:45.540 the CMD folder, or create a new template called Brons Dash Plan Page Dot, go e-mail. 02:47.220 --> 02:49.380 And for right now, we'll make this a simple setup. 02:49.560 --> 02:57.750 So we use our base template and hand it data and we'll give it a title 03:00.570 --> 03:03.870 and we'll just call that bronze plan. 03:06.680 --> 03:15.490 Close off the title, and for now, the content will just be simple just so we can make sure everything 03:15.490 --> 03:28.030 works, we'll just put in H2 in there the class of, say, margin top five, bronze plan close to two. 03:28.900 --> 03:31.090 And I'll put a horizontal rule in there as well. 03:37.170 --> 03:43.110 OK, so if we get everything right, I should be able to type, make run or make start, I guess is. 03:48.410 --> 03:52.520 And let's go to our base template and make sure that links to the correct place. 03:54.700 --> 04:04.270 So subscription is no longer a link to just the hash, it now goes to plans ignorants, which means 04:04.270 --> 04:05.950 I actually need to restart my application. 04:05.950 --> 04:11.110 So let's open our terminal, make stuff like start. 04:14.510 --> 04:17.790 Now let's go back to our Web browser, reload this page. 04:18.440 --> 04:23.510 Go to our products menu and choose subscription and see if we got it right and we did. 04:23.540 --> 04:29.510 OK, so the next step is to start working on the JavaScript, which will be different than the JavaScript 04:29.510 --> 04:34.850 for buying a single widget, because now we're having people purchase a subscription, a recurring monthly 04:34.850 --> 04:37.510 payment, and we'll get started on that in the next election.