The application objective is to fetch 10 Random Chuck Norris jokes. These jokes can be fetched from the following API http://api.icndb.com/jokes/random/10
When jokes are fetched they need to be displayed in a list. In this list we can mark certain jokes as favorite. The favorite jokes will appear in a favorites list with a max of 10 unique items.
There should be an option to remove jokes from the favorite list as well.
On refresh the favorites lists should be stored so next time when application visited, favorites should be present.
In addition, we can also turn a timer on/off via a button (every 5 seconds). This will add one random joke to the favorites list http://api.icndb.com/jokes/random/1 until the list has 10 items.
The application consists of three tiers:
It has one page in ASP.NET MVC that displays the jokes list along with the favorites. It has JavaScript library called jokes.js which exposes the functions that can be performed on a Joke such as fetchSavedJokes, fetchJokes and fireJokesTimer. Such functions are encapsulated into a joke class called JokeHandler, so you need to instantiate it to get access to them.
In addition, there is the view MVC page which references the jokes.js class functions.
2. Middleware (MW):
It is the layer that responsible for parsing the jokes from the FE layer to the backend (BE) layer. This layer can be developed using many tools and technologies such as .NET, NodeJs, or PHP. This application uses .NET Entity Framework to communicate with the data container (here is SQL Server). Here, we use Restful API services to handle jokes.
3. Backend (BE):
It is the data layer where favorite jokes are placed and stored. It can be replaced by any other data containers such as memory storage, web storage or even flat files. We have here one table called Joke which stores Joke Id, value and category. Database structure and table creation script can be found here as well.
As a simple application, it uses a multiselect.js library which can be found here.