Giter Club home page Giter Club logo

phi-test's Introduction

phi-test

Task description

How to run

My setup:

  • Ubuntu linux
  • .NET Core SDK: 8.0.103 [/usr/lib/dotnet/sdk]

Run following command in the root directory of the project:

dotnet build . && dotnet run --project ./src/Phi.Api/

Run tests:

dotnet test

The applications Swagger UI will be accessible on http://localhost:5214/swagger/index.html

Considerations

Cache

In order to not overload HackerNews API, In-memory cache was used for test purposes only. The In-mem approach is not horizontally scalable so in real scenarious some external key/value storage should be used. (redis and so on)

beststories.json endpoint already sorted in descending order

I did not find any confirmation in docs that beststories.json endpoint returns ids sorted in descending by score order but according to tests looks like it is true. My assumption is beststories.json returns ids in descending by score order and I can load story details only for the first N ids.

In case it is not true it needs to load all stories to be able to sort them, which would require a warm-up cache by first requests after application start.

TODOs

  1. Adding AutoMapper configuration to map from HackerNews API model Phi.Model.Client.Story to API model Phi.Model.API.Story
  2. Dockerize the application to not depend on the environment.
  3. Think about the cache invalidation mechanism in case data is changed.
  4. Adding sturtup check in case if configuration is not valid.
  5. Adding more unit tests.

phi-test's People

Contributors

supby avatar

Watchers

 avatar

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.