Giter Site home page Giter Site logo

fastify-json-data-filter's Introduction

JSON DATA FILTER

Filter json data array

Stack

Example data

{
    "examples": [
        {
            "key": "1",
            "value": "Ping"
        },
        {
            "key": "2",
            "value": "Pong"
        }
    ],
    "provinces": [{...}],
    "districts": [{...}],
    "subDistricts": [{...}],
}

Auto generate APIs from example data

  • /examples{?key}{?value}
  • /provinces{?no}{?key}{?translations.th.name}{?translations.en.name}{?postalCodes}{?q}
  • /districts{?no}{?key}{?provinceKey}{?translations.th.name}{?translations.en.name}{?q}
  • /subDistricts{?no}{?key}{?provinceKey}{?districtKey}{?translations.th.name}{?translations.en.name}{?postalCodes}{?q}

Example API Doc

Sub Districts API [/subDistricts{?no}{?key}{?provinceKey}{?districtKey}{?translations.th.name}{?translations.en.name}{?postalCodes}{?q}]

GET DATA [GET]

  • Parameters

    • no: 32 (number, optional) - retrive data no equal 32.
    • key: 100508 (string, optional) - retrive data key equal 100508.
    • translations.th.name: ท่าแร้ง (string, optional) - retrive data translations.th.name equal ท่าแร้ง.
    • translations.en.name: Tha Raeng (string, optional) - retrive data translations.en.name equal Tha Raeng.
    • postalCodes: 10220 (string, optional) - retrive data postalCodes equal 10220 in array.
    • q: Tha (string, optional) - search all value contain Tha *when use 'q' ignore another fields and don't support in array value search
  • Response 200 (application/json)

    • Body

        [
            {
                "no": 32,
                "key": "100508",
                "provinceKey": "10",
                "districtKey": "1005",
                "postalCodes": [
                    10220,
                    10230
                ],
                "translations": {
                    "th": {
                        "name": "ท่าแร้ง"
                    },
                    "en": {
                        "name": "Tha Raeng"
                    }
                }
            }
        ]
      

Enviroment Variable

  • PORT : default 3000
  • DATA_URL : default data
  • CACHE_TTL : default 600 -> 10 mins *cache time out(seconds)

Docker Build

Docker build Apline LTS

yarn docker:build:alpine

Docker build Node 12 Distroless

yarn docker:build:distroless

Reference

fastify-json-data-filter's People

Contributors

jayz-chaiwat avatar jdemon 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.