# n8n-nodes-nuwa

An n8n community node for integrating with GVA (Gin-Vue-Admin) backend systems.

## Features

- **Dynamic API Discovery**: Automatically fetches available API endpoints from your GVA backend
- **Grouped API Selection**: APIs are organized by groups for easy navigation
- **Flexible Request Configuration**: Support for both Form-Data and JSON request bodies
- **Query Parameters**: Add custom query parameters to your requests
- **Secure Authentication**: Uses x-token header authentication

## Installation

### Community Nodes (Recommended)

1. Go to **Settings > Community Nodes** in your n8n instance
2. Click **Install a community node**
3. Enter `n8n-nodes-nuwa`
4. Click **Install**

### Manual Installation

1. Navigate to your n8n custom nodes directory (usually `~/.n8n/custom/`)
2. Clone or download this repository
3. Run `npm install` and `npm run build`
4. Restart your n8n instance

## Configuration

### Credentials

Before using the GVA node, you need to set up your credentials:

1. Go to **Credentials** in your n8n instance
2. Click **Create New Credential**
3. Select **GVA API**
4. Fill in:
   - **Base URL**: Your GVA backend URL (e.g., `https://api.yourdomain.com`)
   - **X-Token**: Your GVA API authentication token

### Node Usage

1. Add the **GVA** node to your workflow
2. Select your GVA API credentials
3. Choose an **API Group** from the dropdown (automatically populated from your backend)
4. Select a specific **API Operation** from the chosen group
5. Configure additional options as needed:
   - **Send Body**: Enable to send request body data
   - **Body Content Type**: Choose between Form-Data or JSON
   - **Query Parameters**: Add custom query parameters

## API Requirements

Your GVA backend must provide an endpoint at `/api/api/getAllApis` that returns API information in the following format:

```json
{
  "data": {
    "apis": [
      {
        "path": "/api/user/create",
        "method": "POST",
        "apiGroup": "User Management",
        "description": "Create a new user"
      },
      {
        "path": "/api/user/list",
        "method": "GET",
        "apiGroup": "User Management",
        "description": "Get user list"
      }
    ]
  }
}
```

## Development

### Prerequisites

- Node.js (LTS version)
- npm or pnpm

### Setup

```bash
git clone <repository-url>
cd n8n-nodes-nuwa
npm install
```

### Build

```bash
npm run build
```

### Lint

```bash
npm run lint
```

### Local Testing

1. Build the project: `npm run build`
2. Link the package: `npm link`
3. Navigate to your n8n custom directory: `cd ~/.n8n/custom/`
4. Link the node: `npm link n8n-nodes-nuwa`
5. Restart n8n

## License

MIT

## Support

For issues and questions, please create an issue in the repository.

---

**MIT License**: This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for full details. MIT allows commercial use, modification, distribution, and private use.