Skip to content
Snippets Groups Projects

Simple Webhook Server

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Alexander Bazo
    index.js 520 B
    import express from "express";
    import { execFileSync } from "child_process";
    
    const app = express();
    
    app.get("/", (request, response) => {
        try {
            const output = execFileSync(process.env.npm_package_config_script, [], {
                stdio: "pipe",
                encoding: "utf-8",
            });
            response.status(200).send("OK");
        } catch (error) {
            console.log(error);
            response.status(501).send("Error while processing webhook");
        }
    });
    
    app.listen(process.env.npm_package_config_port);
    0% or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment