Testing it up

Let's try our Controller by running our app in Debug Mode; in order to test it, we need to manually type the following URL in the browser's address bar:

http://localhost:<port>/api/quiz/latest/3

If we did everything correctly, it will show something like this:

Note how the ViewCount property is not present in the JSON-serialized output; that's by design, since it has been flagged with the JsonIgnore attribute, meaning that we're explicitly opting it out.

Our first Controller is up and running. Do not underestimate it! Eventually, it will be in charge of all quiz-related operations within our web application.

Get ASP.NET Core 2 and Angular 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.