1
00:00:00,668 --> 00:00:01,872
- [Instructor] Hi, and welcome back.

2
00:00:01,872 --> 00:00:03,000
In this video, we're going to verify

3
00:00:03,000 --> 00:00:05,270
that our app works using Postman,

4
00:00:05,270 --> 00:00:07,270
and believe me, it does.

5
00:00:08,880 --> 00:00:12,713
Okay, so let's open up
the Section 6 requests,

6
00:00:13,966 --> 00:00:17,192
and we're not going to change
any of these endpoints,

7
00:00:17,192 --> 00:00:19,067
so we're not gonna create
a new folder there,

8
00:00:19,067 --> 00:00:21,775
just for now, and what we're gonna do is,

9
00:00:21,775 --> 00:00:24,674
make sure to go to, for
example, POST /register,

10
00:00:24,674 --> 00:00:28,017
to create a new user,
but before pressing Send,

11
00:00:28,017 --> 00:00:31,430
we have to change the URL,
so let's go over to this cog,

12
00:00:31,430 --> 00:00:35,504
Manage the Environments, go
to Section 6, and in here,

13
00:00:35,504 --> 00:00:37,587
paste in your Heroku URL.

14
00:00:39,053 --> 00:00:42,473
Make sure to not include
the trailing slash.

15
00:00:42,473 --> 00:00:45,740
Don't include that because
we've already got that

16
00:00:45,740 --> 00:00:47,646
in each endpoint.

17
00:00:47,646 --> 00:00:51,813
So it should be https:// your
API name, or your app name,

18
00:00:52,774 --> 00:00:55,857
.herokuapp.com, and then update that.

19
00:00:57,052 --> 00:00:58,712
We've got the forward
slash at the beginning

20
00:00:58,712 --> 00:01:02,898
of the endpoint, so we
don't need it twice, okay,

21
00:01:02,898 --> 00:01:06,148
and then we're ready, let's press Send,

22
00:01:07,097 --> 00:01:09,425
and there we have, User
created successfully,

23
00:01:09,425 --> 00:01:13,416
then we can press /auth,
and we get an auth token.

24
00:01:13,416 --> 00:01:16,666
If this is in your Tests already, here,

25
00:01:19,088 --> 00:01:20,570
if this is setting the
environment variable,

26
00:01:20,570 --> 00:01:22,735
than you don't have to
do anything with it,

27
00:01:22,735 --> 00:01:27,293
and then we can go to GET
/items, which should be empty.

28
00:01:27,293 --> 00:01:31,795
We can POST a new /item,
which creates an item.

29
00:01:31,795 --> 00:01:35,979
Retrieve the item, test,
which retrieves the item,

30
00:01:35,979 --> 00:01:36,817
and so on.

31
00:01:36,817 --> 00:01:41,371
Now, once we've verified that
we can access a database,

32
00:01:41,371 --> 00:01:43,047
we've not really changed any of the code,

33
00:01:43,047 --> 00:01:46,947
so everything's gonna
work exactly the same,

34
00:01:46,947 --> 00:01:48,036
which is great.

35
00:01:48,036 --> 00:01:51,569
So you can verify all of the
endpoints there if you need,

36
00:01:51,569 --> 00:01:55,711
but you can see, everything
works, and your API is now live

37
00:01:55,711 --> 00:01:58,363
and other people can use it.

38
00:01:58,363 --> 00:02:01,304
So you can see, all that we
need to deploy to Heroku,

39
00:02:01,304 --> 00:02:05,321
is those few files that
tell Heroku what to run,

40
00:02:05,321 --> 00:02:09,250
that GET (mumbles), get the
requirements files and so on,

41
00:02:09,250 --> 00:02:12,273
and once that is done, you
just send your code to Heroku,

42
00:02:12,273 --> 00:02:15,241
and Heroku does all the
work, and you even get https

43
00:02:15,241 --> 00:02:18,610
there as well for some added security.

44
00:02:18,610 --> 00:02:22,960
So Heroku is really great,
but, there is a small problem,

45
00:02:22,960 --> 00:02:26,356
which is that we're still using SQLite,

46
00:02:26,356 --> 00:02:28,353
we're still using SQLite in our code,

47
00:02:28,353 --> 00:02:32,520
and in the Heroku system, we
are creating that data.db file

48
00:02:33,969 --> 00:02:37,127
and we're putting our data
in it, and that's fine,

49
00:02:37,127 --> 00:02:40,665
but there is a very small
limit to the amount of space,

50
00:02:40,665 --> 00:02:43,761
the amount of disc space,
that Heroku gives us,

51
00:02:43,761 --> 00:02:47,928
and in the free tier, we have
a very limited number of hours

52
00:02:49,558 --> 00:02:51,308
that our dynos can run.

53
00:02:51,308 --> 00:02:53,297
If you verify your email address,

54
00:02:53,297 --> 00:02:56,114
the number of hours that
your free dynos can run for

55
00:02:56,114 --> 00:02:58,492
is a combined of 1,000 hours.

56
00:02:58,492 --> 00:03:00,571
If you have not activated
your email address,

57
00:03:00,571 --> 00:03:04,428
that's 550 hours, at least
at the time of recording.

58
00:03:04,428 --> 00:03:07,711
However, even though 1,000 hours is more

59
00:03:07,711 --> 00:03:11,294
than a month's worth,
and every 30 minutes,

60
00:03:12,364 --> 00:03:15,060
if nobody makes a request to your dyno,

61
00:03:15,060 --> 00:03:18,567
the dyno will go to sleep,
and we get destroyed

62
00:03:18,567 --> 00:03:22,210
and therefore, and than,
when you access it again,

63
00:03:22,210 --> 00:03:25,725
after half an hour, Heroku
will create it again,

64
00:03:25,725 --> 00:03:29,340
but during that creation,
your files will be lost,

65
00:03:29,340 --> 00:03:33,181
so you will lose data.db,
which is not ideal.

66
00:03:33,181 --> 00:03:36,906
So what the solution is, is to use a more

67
00:03:36,906 --> 00:03:38,908
available data storage.

68
00:03:38,908 --> 00:03:41,911
For example, Postgres or MySQL,

69
00:03:41,911 --> 00:03:44,204
and we're going to look at
exactly how we can do that,

70
00:03:44,204 --> 00:03:47,808
because Heroku also
provides its own Postgres,

71
00:03:47,808 --> 00:03:50,230
PostgreSQL installation, which we can use,

72
00:03:50,230 --> 00:03:51,920
which is also free.

73
00:03:51,920 --> 00:03:54,277
So, we're gonna look at that
in the next coming videos,

74
00:03:54,277 --> 00:03:56,023
so I'll see you there.

