GithubHelp home page GithubHelp logo

alaal / directus-extension-randomized Goto Github PK

View Code? Open in Web Editor NEW

This project forked from br41nslug/directus-extension-randomized

0.0 0.0 0.0 639 KB

An extension to get randomized results from directus.

License: MIT License

TypeScript 100.00%

directus-extension-randomized's Introduction

Directus Extension Randomized Results

As the name suggests this extension will enable Randomized results mirroring the Directus /items/:collection endpoint.

Tested with Directus 10.6.3

Installation

The package is published to npm: npm install directus-extension-randomized-endpoint

Manual Installation

  • Download or fork the repository
  • Install the requirements
    npm install
  • Build the extension
    npm run build
  • Move the result to your extension folder
    mv dist extensions/endpoints/directus-extension-randomized
  • Restart your Directus instance

Usages

Mirrors the REST version of this core endpoint supporting the same parameters https://docs.directus.io/reference/items.html#get-items

GET /randomized/test_collection

[
   { "id": 6, "status": "draft", "value": "369" },
   { "id": 2, "status": "published", "value": "456" },
   { "id": 4, "status": "published", "value": "147" },
   { "id": 3, "status": "published", "value": "789" },
   { "id": 5, "status": "draft", "value": "258" },
   { "id": 1, "status": "published", "value": "123" }
]
[
    {"id": 3, "status": "published", "value": "789"},
    {"id": 4, "status": "published", "value": "147"},
    {"id": 1, "status": "published", "value": "123"},
    {"id": 2, "status": "published", "value": "456"},
    {"id": 5, "status": "draft", "value": "258"},
    {"id": 6, "status": "draft", "value": "369"}
]

GET /randomized/test_collection?limit=2

[
    {"id": 4, "status": "published", "value": "147"},
    {"id": 5, "status": "draft", "value": "258"}
]
[
    {"id": 2, "status": "published", "value": "456"},
    {"id": 4, "status": "published", "value": "147"}
]

GET /randomized/test_collection?limit=2&filter[status][_eq]=published&fields=value,status

[
    {"value": "456", "status": "published"},
    {"value": "147", "status": "published"}
]
[
    {"value": "789", "status": "published"},
    {"value": "147", "status": "published"}
]

directus-extension-randomized's People

Contributors

br41nslug avatar sandros94 avatar thundernerd 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.