express-microservice

Documentation

n8n Express Microservice Trigger Node

A custom n8n trigger node that allows users to visually configure Express.js microservices that trigger workflow executions on HTTP requests.

šŸŽÆ v1.3.0 - Major Update: Full Trigger Node

This node is now a true trigger node where each HTTP request starts a new workflow execution, not just a regular node that processes requests.

Features

  • šŸš€ Dynamic Express Server: Create HTTP endpoints on-the-fly
  • šŸŽÆ Workflow Triggering: Each HTTP request triggers a new workflow execution
  • šŸŽ›ļø Visual Configuration: Configure routes, methods, and responses through n8n UI
  • šŸ”§ Port Management: Automatic port availability checking with hot-reload
  • šŸ“Š Multiple HTTP Methods: Support for GET, POST, PUT, PATCH, DELETE
  • šŸ”’ Security: Built-in authentication options (Basic Auth, API Key)
  • šŸ”„ n8n Integration: Full trigger integration with request data emission
  • šŸ“” Real-time Processing: Perfect for webhooks and event-driven workflows

Installation

  1. Clone the repository

    git clone <repository-url>
    cd n8n-express-microservice-node
    
  2. Install dependencies

    npm install
    
  3. Build the project

    npm run build
    
  4. Install in n8n

    • Copy the built node to your n8n custom nodes directory
    • Restart n8n to load the new node

Development

Build

npm run build

Watch mode for development

npm run dev

Run tests

npm test

Lint code

npm run lint

Project Structure

ā”œā”€ā”€ nodes/
│   └── ExpressServerNode/
│       ā”œā”€ā”€ ExpressServerNode.node.ts    # Main node implementation
│       └── ExpressServerNode.node.json  # Node metadata
ā”œā”€ā”€ test/                                # Test files
ā”œā”€ā”€ dist/                               # Built files
ā”œā”€ā”€ package.json                        # Dependencies and scripts
ā”œā”€ā”€ tsconfig.json                       # TypeScript configuration
└── README.md                          # This file

Usage

  1. Add the node to your n8n workflow
  2. Configure the port where the Express server should run
  3. Define HTTP methods with their routes and responses
  4. Activate the workflow to start the Express server
  5. Make HTTP requests to the configured endpoints

Example Configuration

{
  "port": 3001,
  "methods": [
    {
      "name": "/health",
      "httpMethod": "GET",
      "successCode": 200,
      "failureCode": 500,
      "contentType": "application/json",
      "outputMapping": "{\"status\":\"ok\"}"
    }
  ]
}

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT

Discussion