Wondering what’s next for npm?Check out our public roadmap! »

    hasura-triggers

    0.0.0-1 • Public • Published

    Hasura Triggers

    hasura triggers for simplified (single endpoint)

    Installation

    npm i --save hasura-triggers
    

    Usage

    const express = require("express");
    const hasuraTriggers = require("hasura-triggers");
    const config = require("./config");
     
    const app = express();
     
    app.use("/hasura/triggers", hasuraTriggers(config))
     
    app.listen(3000, function(err){
        if(err) console.log(err.message);
        else console.log("Listening on localhost:3000");
    })

    config.js

    const { updateEvent, deleteEvent } = require("./handlers");
     
    module.exports = {
        schema_name: {
            table_name: {
                insert: async function(body, headers){
                    // Custom Buisness Logic
                    return {
                        message: "operation successful"
                    }
                },
                update: updateEvent,
                delete: deleteEvent
            }
        }
    }

    Install

    npm i hasura-triggers

    DownloadsWeekly Downloads

    2

    Version

    0.0.0-1

    License

    ISC

    Unpacked Size

    3.28 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar