1 00:00:02,250 --> 00:00:04,570 In the last lecture we built our files, 2 00:00:04,610 --> 00:00:10,350 now I want to deploy it and you're really free to choose which ever static file host you want to use. 3 00:00:10,430 --> 00:00:16,730 Simply follow the instructions of your chosen host to upload the files in the build folder and make 4 00:00:16,730 --> 00:00:19,040 sure that you always return the index.html 5 00:00:19,040 --> 00:00:22,910 file. I'll use firebase hosting, 6 00:00:22,910 --> 00:00:25,920 so in the firebase console of the project we already have, 7 00:00:26,000 --> 00:00:32,710 we can click on hosting and there on get started, we get instructions. Now for firebase hosting, 8 00:00:32,750 --> 00:00:36,570 we actually need to install an extra tool globally on our machine, 9 00:00:36,710 --> 00:00:42,520 if you don't want this simply follow along with another static host of your choice like AWS S3 10 00:00:42,540 --> 00:00:43,010 . 11 00:00:43,010 --> 00:00:48,710 check out the documentations of whichever host you chose to learn how to deploy to that specific 12 00:00:48,710 --> 00:00:49,460 page. 13 00:00:49,460 --> 00:00:54,330 So here I'm going to copy the command and with sudo on Mac, 14 00:00:54,350 --> 00:01:01,310 on Windows you don't need that and then the copied command, I can install these firebase tools globally 15 00:01:01,370 --> 00:01:02,320 on my machine. 16 00:01:02,330 --> 00:01:05,090 Now it will take a couple of seconds for this to finish, 17 00:01:05,090 --> 00:01:08,920 we can already jump ahead and have a look at the second step. 18 00:01:08,930 --> 00:01:09,910 There you see that 19 00:01:09,920 --> 00:01:15,830 once the tools were installed, you can run firebase login to authenticate with your firebase account and 20 00:01:15,830 --> 00:01:21,410 then initialize your project to be the firebase project you want to deploy and then deploy with the 21 00:01:21,410 --> 00:01:22,650 deploy command, 22 00:01:22,670 --> 00:01:24,250 now we'll do this together. 23 00:01:24,620 --> 00:01:26,410 So let's wait for days to finish, 24 00:01:27,220 --> 00:01:31,550 once it did finish, you have to run the firebase login. 25 00:01:31,570 --> 00:01:38,110 I already did this I'll continue with firebase init and now you're asked which features you want to use here, 26 00:01:38,110 --> 00:01:42,430 now we can just check hosting by pressing space after navigating to that option, 27 00:01:42,430 --> 00:01:44,110 we don't need any of the other, 28 00:01:44,350 --> 00:01:47,260 then hit enter. 29 00:01:47,380 --> 00:01:49,940 Now you choose the project you want to use, 30 00:01:50,050 --> 00:01:51,320 so I'll do that here too. 31 00:01:52,200 --> 00:01:58,360 Now you asked what your public directory is and for us, that's not the default of public but build, 32 00:01:58,680 --> 00:02:05,080 that tells firebase which files to upload and we want to upload all files in the build directory, 33 00:02:05,150 --> 00:02:07,530 So I'll enter build. 34 00:02:07,600 --> 00:02:10,180 Now do we want you configured as a single page app? 35 00:02:10,210 --> 00:02:11,440 yes we do. 36 00:02:11,440 --> 00:02:14,870 This will automatically set this up to always return index.html 37 00:02:14,920 --> 00:02:16,030 as it says here 38 00:02:16,090 --> 00:02:18,730 so enter Y for yes. 39 00:02:18,840 --> 00:02:22,530 Now it asks us if it should overwrite the index.html file it found, 40 00:02:22,530 --> 00:02:23,670 the answer is No 41 00:02:23,670 --> 00:02:31,170 so N because we obviously want to keep the one generated by our project and with that we're done. Now 42 00:02:31,180 --> 00:02:37,770 in the case of firebase, this gave us a special firebase rc file and a firebase.json file to configure 43 00:02:37,770 --> 00:02:43,270 this project. FirebaseRC simply contains information about this project, 44 00:02:43,420 --> 00:02:46,200 obviously you should replace this with your project ID, 45 00:02:46,360 --> 00:02:53,230 if you ever download my project and want to use that and firebase.json this is where the hosting is configured, 46 00:02:53,350 --> 00:02:58,510 where the public folder is set up to be the build folder, where it ignore some files to not upload 47 00:02:58,550 --> 00:03:05,500 these and where it also rewrites all incoming requests to return index.html and for firebase, you 48 00:03:05,500 --> 00:03:09,680 can read more in their documentation, for your favorite static site hosts, 49 00:03:09,730 --> 00:03:11,810 you pick their docs, of course. 50 00:03:11,980 --> 00:03:17,140 So for firebase with all that set up, we can deploy this with firebase deploy, for other hosts, 51 00:03:17,140 --> 00:03:22,210 you might need to manually upload the files there, that also shouldn't be too difficult though. 52 00:03:22,510 --> 00:03:28,060 So with that, it's preparing our build directory for upload as it's saying, it uploaded it and now we can visit 53 00:03:28,060 --> 00:03:34,520 the application here under this hosting URL and there also are ways for assigning your own domain, 54 00:03:34,570 --> 00:03:39,760 just check out the firebase docs if you're interested. Let's visit this page 55 00:03:39,970 --> 00:03:46,700 and now there, we see our application running as it ran on our local machine. 56 00:03:46,960 --> 00:03:54,520 So there of course we can now also login, it's using the same database behind the scene and then also 57 00:03:54,520 --> 00:04:00,370 start building our burger here, order that and so on. 58 00:04:00,410 --> 00:04:04,600 This is now our application running on a real server.