1
00:00:00,000 --> 00:00:04,414
[MUSIC]

2
00:00:04,414 --> 00:00:09,190
Time to move on to the second
assignment in this course.

3
00:00:09,190 --> 00:00:13,870
In this module we have been
working with MongoDB and Mongoose.

4
00:00:13,870 --> 00:00:20,890
We have seen how we can use Mongoose
to set up the schema and the model for

5
00:00:20,890 --> 00:00:27,050
a document, and
also set up the Mongoose ODM to be able to

6
00:00:27,050 --> 00:00:32,390
interact with our MongoDB
database in the back end.

7
00:00:32,390 --> 00:00:39,260
We have also learned how we would
be able to update the REST API

8
00:00:39,260 --> 00:00:43,630
server in order to interact
with the MongoDB database,

9
00:00:43,630 --> 00:00:48,150
we specifically did
that with the end part.

10
00:00:48,150 --> 00:00:54,960
In the second assignment we will complete
the implementation of the REST API

11
00:00:54,960 --> 00:01:00,270
express router that we have
built up in this course.

12
00:01:00,270 --> 00:01:05,050
So in the second assignment we will
have two tasks to be completed.

13
00:01:06,990 --> 00:01:13,510
The first task in the second assignment is
to build up the schema and the model for

14
00:01:13,510 --> 00:01:18,860
the promotions which will be
supported by other x plus router.

15
00:01:18,860 --> 00:01:23,760
An example of a promotion document
is given to you here, and

16
00:01:23,760 --> 00:01:27,790
also given to you in
the assignment instructions, so

17
00:01:27,790 --> 00:01:33,800
this promotion document will contain
several fields as shown there.

18
00:01:33,800 --> 00:01:39,384
You need to implement
the corresponding Mongoose schema and

19
00:01:39,384 --> 00:01:44,419
Mongoose model, and
thereafter you will be using this

20
00:01:44,419 --> 00:01:50,136
mongoose schema and
the model in your promoRouter.js file.

21
00:01:50,136 --> 00:01:55,852
Recall that the promoRouter.js file is
the one that supports the /promotions and

22
00:01:55,852 --> 00:01:59,280
the /promotions/promoId in parts.

23
00:01:59,280 --> 00:02:05,680
So you'll be updating the promo router
to access the MongoDB database,

24
00:02:05,680 --> 00:02:10,935
using Mongoose to interact with
the database to support the get,

25
00:02:10,935 --> 00:02:16,070
put, post, and delete operations
on the REST API endpoints.

26
00:02:16,070 --> 00:02:20,530
So that would be the first
task in this assignment,

27
00:02:20,530 --> 00:02:25,900
at the end of this task of
course you will be able to save

28
00:02:25,900 --> 00:02:31,830
a promotion to your database and
retrieve the promotion, update,

29
00:02:31,830 --> 00:02:37,700
and delete promotions using the get,
put, post, and delete operations.

30
00:02:37,700 --> 00:02:41,850
Your second task in this
assignment is to obviously

31
00:02:41,850 --> 00:02:46,290
implement the leaders schema in the model.

32
00:02:46,290 --> 00:02:51,330
An example of the leaders
document is given here, and

33
00:02:51,330 --> 00:02:53,570
also in the assignment instructions.

34
00:02:53,570 --> 00:02:56,660
So the leader document
contains several fields,

35
00:02:56,660 --> 00:02:59,850
you need to implement
the corresponding Mongoose schema and

36
00:02:59,850 --> 00:03:03,850
the model to support all
these different fields.

37
00:03:03,850 --> 00:03:07,110
Thereafter, you will be using
the Mongoose schema and

38
00:03:07,110 --> 00:03:12,210
model in your leaderRouter.js file, and

39
00:03:12,210 --> 00:03:17,612
support the get, put, post, and
delete operations on that /leaders and

40
00:03:17,612 --> 00:03:23,360
the /leaders/currentleaderId
REST API in parts,

41
00:03:23,360 --> 00:03:27,990
just like the way you did with
the promotions and the promo router.

42
00:03:27,990 --> 00:03:32,760
So once you complete updating
both the promotions and

43
00:03:32,760 --> 00:03:37,830
the leaders support,
including the REST API endpoint support,

44
00:03:37,830 --> 00:03:43,645
then your Express REST API
server will be almost ready for

45
00:03:43,645 --> 00:03:49,060
serving up all the data that is
required by your planned application.

46
00:03:49,060 --> 00:03:52,534
Have fun completing the second
assignment in this course.

47
00:03:52,534 --> 00:03:56,629
[MUSIC]