Git Product home page Git Product logo

lofino-recruiting-node's Introduction

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.

Prerequisites

  • an installation of Node.js and npm
  • your favorite IDE
  • a possibility to share the result, e.g Dropbox or Github

Tasks

This repository comes with two software projects: A Node.js based backend and a React based frontend. You find them in the respective directories.

Backend

  • 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 the petsRepository for that.
  • implement the getTrendingPet() function in service/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.

Frontend

  • 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 and frontend/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)

Code Review

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.

Getting started

  • install dependencies on the backend

    cd backend
    npm install
  • start the backend app with npm start

    npm start
  • use an HTTP client like curl or Postman 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.

Some Notes

  • 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

Your Notes

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.