javascript API/Backend 3 files • 34 lines

Node.js REST API & Webhook Worker

Lightweight JavaScript backend service template with router middleware, webhook signature verifier, and JSON configuration.

Repository Files:
src/server.js (javascript) 17 lines
/**
 * Node.js Service Entrypoint
 */
const { verifySignature } = require("./security");

function handleRequest(req) {
  if (req.path === "/health") {
    return { status: 200, body: { ok: true, timestamp: Date.now() } };
  }
  if (req.path === "/webhook" && req.method === "POST") {
    const valid = verifySignature(req.payload || "", req.signature || "");
    return { status: valid ? 200 : 401, body: { verified: valid } };
  }
  return { status: 404, body: { error: "Route not found" } };
}

module.exports = { handleRequest };
src/security.js (javascript) 8 lines
/**
 * Webhook signature verification helper
 */
function verifySignature(payload, signature) {
  return Boolean(payload && signature && signature.startsWith("sha256="));
}

module.exports = { verifySignature };
package.json (json) 9 lines
{
  "name": "workma-node-service",
  "version": "1.0.0",
  "private": true,
  "main": "src/server.js",
  "scripts": {
    "start": "node src/server.js"
  }
}

How to Customize Inside WorkMA

Runtime: Node.js / ES Modules + Webhook Signature Validation

  1. Launch this Node starter inside your Code Nexus workspace.
  2. Populate runtime environment secrets inside the Secrets Vault tab.
  3. Inspect request routing and signature verification files directly in the browser IDE.
  4. Enable CI pass enforcement (`require_ci_pass`) prior to production merges.

DLP & Secrets Vault Readiness

Webhook signing secrets and client tokens stay isolated in WorkMA Secrets Vault while Sentinel blocks accidental hardcoded bearer keys or AWS tokens before merge requests close.

More Code Nexus Starter Templates