Welcome to our LOFINO Coding Challenge!
Your task is to extend a small client/server web application that lets you upload profiles of your pet so others can rate them.
- an installation of Node.js and npm
- your favorite IDE
- a possibility to share the result, e.g Dropbox or Github
This repository comes with two software projects: A Node.js based backend and a React based frontend. You find them in the respective directories.
- provide a server application based on Node.js that serves an API over HTTP
- extend the API to allow users to rate existing pets (e.g. give a rating of 1-5 per pet)
- the ratings should be stored on the backend as well. You can call
addRating()
in thepetsRepository
for that.
- the ratings should be stored on the backend as well. You can call
- implement the
getTrendingPet()
function inservice/petsService
that finds the trending Pet for an arbitrary point in time. A pet is considered trending if it has the most ratings within a time frame of the previous 7 days from the point in time we want to consider. - provide an endpoint which returns the trending pet for the current day. Note that the trending pet may change as you add ratings.
- provide a frontend application based on React.js that consumes the backend API
- create a start page that lists all the pets with their infos
- display the name and image
- display the current age of the pet
- display the average rating and the number of ratings
- on the details page of the pet, add an input element that lets the user rate the pet (which sends the rating to the backend).
- Make this rating element look like the interactive 5-star rating UI known from e.g. amazon.
- encode the existing rating in this ui element. I.e. if the pet has an average rating of 3.2, display the first 3 stars differently than the remaining 2 stars. You can use
frontend/public/star-empty.png
andfrontend/public/star-filled.png
for that.
- BONUS: if today is the birthday of a pet then show this picture of a birthday hat rotated and halfway overlapping with the pet image (see mockup)
There's a branch feature/findDate
in this repository. Check it out with git checkout feature/findDate
.
You'll find a file backend/service/findDate.ts
. It exports a function that searches for formatted dates in an array of string. It has nothing to do with pets :D Suppose someone from your team wants to merge this to master
.
- perform a code review of
findDate.ts
. Comment on lines that you find problematic or could be improved, or if you have any other comments. Take into consideration requirements like readability, maintainablilty, performance, security etc.
You may do this by creating a pull request on Github and comment the changes there, or just write comments into the code, or any other way that you find appropriate.
-
install dependencies on the backend
cd backend npm install
-
start the backend app with
npm start
npm start
-
use an HTTP client like
curl
orPostman
to see if the server is responding to requests.curl http://localhost:8080/hello
->Hello World!
-
install dependencies on the frontend
cd frontend npm install
-
start the frontend with
npm start
npm start
-
open
http://localhost:3000/
with your web browser. You should see a simple web page with pictures of animals.
- Feel free to use third party modules where appropriate. You may also change the structure of the files the way you think is appropriate.
- Some of the software structure is not great. Feel free to refactor existing modules as you please.
- There are tests for both projects. Make sure they pass. Feel free to extend the tests where appropriate.
- Focus on code quality and working software, try to follow best practices.
- Keep an eye on security, usability etc.
- If you feel you're stuck on something, work on something else instead
- Feel free to add comments on the code if you want to explain something or on a place that could be improved
- you can also add comments on the bottom of this document
Here you can add your own notes and comments about the project. For example, what trade offs did you have to decide for? What would you have done differently if you had more time? What did you think of the tasks? Was it too much / too easy / too ambiguous?