Coder Social home page Coder Social logo

feeds's Introduction

feeds

Design

  • The service layer is based on Spring Boot.
  • Uses MongoDB at the datastore layer.
    I chose MongoDB because each read/write operation to the DB can be independent, we do not need transaction management in this kind of application. Users/Feeds/Articles could get added/removed independently. MongoDB allows schema-less design so content of articles can change independently. MongoDB allows eventual consistency, it's okay in this kind of application where when an article is added to Feed, the article may surface up after some time to the user.
  • The REST APIs are based on HATEOAS

Entities

  • Users
    • Collection name: Users
  {
    "username" : "<username>",
    "subscribed_feeds" : [ "feed1", "feed2", ... ]
  }
  • Feeds
    • Collection name: Feeds
  {
    "name" : "<feedname>",
    "articles": [ { ... }, { ... } ]
  }

The MongoDB can be configured in com.bufferworks.feeds.MongoDbConfig
DB Name: feedsportal
DB Connection: localhost/27017

Compiling and running the program

  • The application based on Spring Boot
  • Use mvn clean package to build the source. This will also run the tests.
  • This will generate a runnable jar target/feeds-0.1.jar
  • To execute the program: java -jar target/feeds-0.1.jar
    Add -Dserver.port=9090 to run the server on a different port
    DB config parameters can be updated using -
    java -Dmongodb.host=localhost -Dmongodb.port=27017 -Dmongodb.database=test -jar target/feeds-0.1.jar

Using API's

  • The API's are implemented following the HATEOAS paradigm where response have links to follow specifying the actions available
  • Root Resource lists all sub resources, available via
    URL: http://localhost:8080/jersey/api
    Headers: Accepts: application/com.bufferworks.root+json
  • Added Feeds.json that is a postman collection to with API requests
  • All REST resources are under com.bufferworks.feeds.restapi.resource package.
  • All media types for REST resources are under com.bufferworks.feeds.restapi.media package.
  • MongoDB DB Services are under com.bufferworks.feeds.persist package.
  • MongoDB entities are under com.bufferworks.feeds.persist.entity package.

API Resources

  • UsersResource
  • UserResource
  • FeedsResource
  • FeedResource
  • ArticlesResource
  • SubscriptionsResource
  • UserArticlesResource

Integration for Test Resources

  • ArticlesResourceIntegrationTest
  • FeedResourceIntegrationTest
  • FeedsResourceIntegrationTest
  • SubscriptionsResourceIntegrationTest
  • UserArticlesResourceIntegrationTest - This integration test creates a user, creates feeds and adds articles to the feeds. Subscribes the user to 3 feeds and then returns all articles associated with the subscribed feeds.
  • UserResourceIntegrationTest
  • UsersResourceIntegrationTest

feeds's People

Contributors

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