Skip to content

A simple Reactions microservice built using Elixir and caching using the Erlang Term Storage(ETS).

Notifications You must be signed in to change notification settings

ro6ley/fantastic-reactions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReactionsService

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Endpoints

Post a new reaction:

  • endpoint: localhost:4000/api/reactions (POST)

  • payload:

    {
      "action":"remove",
      "content_id":"12",
      "reaction_type":"fire",
      "type":"reaction",
      "user_id":"17"
    }
  • success response:

    {
      "msg":"Reaction added"
    }

Get the number of reactions on content:

  • endpoint: localhost:4000/api/reactions/<content-id> (GET)
  • success response:
    {
      "content_id": "056af-2ef3",
      "reaction_count": {
          "fire": 1
      }
    }

Assumptions

  • Reaction types and their metadata are not maintained or controlled in this service
  • The reactions are to be persisted later by the same service after a set period of time or certain limits are achieved

Reasons for using ETS instead of third party caching solutions

  • It requires no additional dependencies since ETS is part of the Erlang VM,
  • It allows me store Elixir data structures thus eliminating the need for serialization and enhancing speed,
  • The service was to be deployed on a single node, ETS makes the solution simpler,
  • Other third-party solutions such as ConCache are built on top of the ETS,

Learn more

About

A simple Reactions microservice built using Elixir and caching using the Erlang Term Storage(ETS).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages