Code Monkey home page Code Monkey logo

nukr's Introduction

Nukr - Social media connections

The problem statement is as follows: You are tasked with making Nukr, a new social media product by Nu Everything S / A. The initial step is to create a prototype service that provides a REST API where we can simulate connections between people, and explore how we would offer new connection suggestions. These are the features required:

  • Be able to add a new profile;
  • Be able to tag two profiles as connected;
  • Be able to generate a list of new connection suggestions for a certain profile, taking the stance that the more connections to profile have with another profile's connections, the better ranked the suggestion should be;
  • Some profiles can, for privacy reasons, opt to be hidden from the connection suggestions.

Prerequisites

You will need Leiningen 2.0.0 or above installed.

The API has 4 primary endpoints that can be accessed as soon as the application is started.

1 [POST] - http://localhost:3000/add-profile

Make a POST request at this route and pass a JSON like this:

{
    "name": "Bruce",
    "email: "[email protected]"
}

The profile Bruce will be added on the Nukr and a JSON like this will be returned:

{
    "[:user/email \"[email protected]\"]": {
        "user/name": "Bruce",
        "user/email": "[email protected]",
        "user/hidden": false,
        "user/connections": []
}

2 [PUT] - http://localhost:3000/connect-profiles

Make a PUT request at this route and pass a JSON like this:

{

    "host": "[email protected]",
    "guest": "[email protected]"
}

Where HOST is your profile and GUEST is the profile that you want to connect to. The connection will be made to the two profiles. And it will be returned something like:

"[:user/email \"[email protected]\"]": {
    "user/name": "Bruce",
    "user/email": "[email protected]",
    "user/hidden": false,
    "user/connections": [
        "[email protected]"
    ]
},
"[:user/email \"[email protected]\"]": {
    "user/name": "Jason",
    "user/email": "[email protected]",
    "user/hidden": false,
    "user/connections": [
        "[email protected]"
    ]
}

3 [POST] - http://localhost:3000/connection-suggestions

Make a POST request at this route and pass a JSON like this:

{
    "email": "[email protected]"
}

Where email is referenced to the email of your profile. Suggestions are created from the common connections of your own connections, for example: Suppose you are profile the "A" and are connected to profile "B" and "C", and the two are connected to profile "D", then "D" becomes a connection suggestion. And the more connections your own connections have in common, the better ranked are the suggestions for you.

4 [PUT] - http://localhost:3000/change-hidden-status

It is possible that other profiles will receive you as a connection suggestion. To change your privacy status, make a PUT request like this:

{
    "email": "[email protected]",
    "new-status": true
}

This will changed the status hidden false to true

Note: The other profiles can also change the status so they do not appear in your suggestions

Running

To install the dependencies, run:

lein deps

To start a web server for the application, run:

lein ring server

Running tests

lein test

nukr's People

Contributors

rvphael 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.