Giter Site home page Giter Site logo

tonyhernandez / json-rules-service Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 78 KB

Simple node app that wraps the json-rules-engine library to allow you to externally run and execute business rules.

JavaScript 100.00%
business-rules business-rules-engine rules-engine rule-engine

json-rules-service's Introduction

json-rules-service

Getting Started

Json rules service wraps the json-rules-engine in an API that allows you to run your business rules and decision outcomes via an external service. A simple POST API to effortlesly run business rules defined in json files created using json-rule-editor.

Process to implement json rule file in the service is as follows

  • Generate rule file using json rule editor
  • Place the generated file in the src/rules folder,
  • and pass the name of the file (without .json) and input parameters to the API to get the output.

Usage:

To launch the json rule editor tool, you can do either of the below

  1. Click json rule editor
  2. or install it locally via git clone https://github.com/vinzdeveloper/json-rule-editor.git
    • start the application by npm install and npm start
  3. Create your business rules and then download the json file to src/rules/. The detailed steps to create json rule file using this tool can be found here.
  4. Start the rules service by running npm install and npm start
  5. Call the API to execute your rules:
    curl --location --request POST 'http://localhost:3000/rule' \
          --header 'Content-Type: application/json' \
          --data-raw '{
               "inputs": {
                    "item": "bone"  <-- facts/inputs you created for your rule
               },
               "rules" : "discount-rules"  <-- name of your rules json file
          }'

rule execution

json-rules-service's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

maclezhou

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.