- Questions that you need to answer (as a group!) are indicated with question mark symbols (:question:).
- Tasks that specify work to do without a written response will be bulleted.
Responses to questions should be submitted as specified by your instructor.
If you're ever confused about what you need to do for a given task, ask.
The structure of this project should be nearly identical to that of lab #3, and as such there really isn't much excitement in that department.
The server is, for the most part, the same as it has been in the past two labs. The difference to look for here is in how the server gets the data it sends out in reply to requests.
Answer questions 1-6 in QUESTIONS.
- Re-implement the ToDo API, this time pulling data from MongoDB rather than from a flat JSON file.
- When displaying the ToDos in your Angular front-end, make thoughtful decisions about whether work like filtering should be done in Angular or via database queries. It would be reasonable, for example, to have the database filter out all the ToDos belonging to a single user, but let Angular filter by category or status.
- We have included an example of writing to the database with
addUser
functionality. Add to both the front-end and back-end to make it possible to add ToDos so that they appear both in your list and in the database.
To see an example of using the database and the server to do some useful work
(instead of having everything happen in Angular), implement an API endpoint
/api/todoSummary
which provides summary information about a group of
ToDos in the following format:
{
percentToDosComplete: Float,
categoriesPercentComplete: {
groceries: Float,
...
}
ownersPercentComplete: {
Blanche: Float,
...
}
}
So you should add a new endpoint to your Spark routes, and then have that call some method (possibly in a new class?) that queries the DB for the relevant data and assembles this JSON response. Note that you can use MongoDB aggregation to do most of this calculation without having to actually download all the todos, organize, and count them yourself.
- Use the front-end tools you've learned about to build a nice interface for
accessing these APIs:
- You must use Glyphicons somewhere
- You must use at least two of the following nifty Bootstrap features:
Test test and more test! Your project again should have tests. You should contiue expanding upon your previous end-to-end test as well as implement Unit Test for both your client-side and the server-side.
-
The gradle task runClientTestsWithCoverage will be extremely useful to see how covered your client-side is by test.
-
Continue expanding upon your
TESTCOVERAGE.md
file with any additional end-to-end test added.
- Remember to add JUnit Test as you re-implement your ToDo API.
❗Pro-Tip: Test Coverage can be produced on IntelliJ as well! Go to to your server test folder and Right-click on the test folder and select Run 'All Test' with Coverage which will then provide a report of coverage in your server code in the side bar.
Additionally you can Right-click, select Analyze -> Generate Coverage Report... which will prompt you for an output directory and give you the option to view the report an HTML report in a browser.
- ❓ What do we do in the
Server
andUserController
constructors to set up our connection to the development database? - ❓ How do we retrieve a user by ID in the
UserController.getUser(String)
method? - ❓ How do we retrieve all the users with a given age
in
UserController.getUsers(Map...)
? What's the role offilterDoc
in that method? - ❓ What are these
Document
objects that we use in theUserController
? Why and how are we using them? - ❓ What does
UserControllerSpec.clearAndPopulateDb
do? - ❓ What's being tested in
UserControllerSpec.getUsersWhoAre37()
? How is that being tested?