Coder Social home page Coder Social logo

filtering's Introduction

This application is an implementation of the idea of creating data filters.

This is a pet-project for implementing the idea of creating data filters using Redis. This is my first project in Kotlin using Redis.

The idea of creating filters

When I created API using filters in them, I was constantly discouraged with using POST requests for filtering data. After all, it's better to use GET request to receive and filter data. One day, I came across an answer on StackOverflow with a proposal of this idea.

The algorithm of filtering data in API:

  1. Front application sends a POST request to create a filter (i.e. instead of sending GET request to receive data by the filter, it sends to create the filter)
  2. Backend application saves JSON value of filter to the Redis (the redis key is the hash of JSON string(it's a simple Java hash, which was obtained by calling the java.lang.Object#hashCode() method))
  3. After it, backend sends response with filled Location header and HTTP status 301.
  4. Then, we can send the request to URL, which was indicated in Location header and we will get data, which was request in the first request.

Stack:

  • Kotlin
  • Spring Boot
  • Spring Data
  • Gradle
  • Flyway
  • Redis (and Spring Jedis library)

P.S. Since this is a pet-project, the main emphasis was placed on the implementation of the idea and its verification. Therefore, I did not add multiple checks for various variants of the transmitted data (in other words, I did not validate the input data).

filtering's People

Contributors

shagbark avatar

Watchers

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