mirror of
				https://github.com/n8n-io/n8n-nodes-starter.git
				synced 2025-10-28 14:12:24 -05:00 
			
		
		
		
	🎉 Initial commit
This commit is contained in:
		
				commit
				
					
						d3a225f94e
					
				
			
		
					 10 changed files with 537 additions and 0 deletions
				
			
		
							
								
								
									
										57
									
								
								nodes/ExampleNode/ExampleNode.node.ts
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								nodes/ExampleNode/ExampleNode.node.ts
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,57 @@ | |||
| import { IExecuteFunctions } from 'n8n-core'; | ||||
| import { | ||||
| 	INodeExecutionData, | ||||
| 	INodeType, | ||||
| 	INodeTypeDescription, | ||||
| } from 'n8n-workflow'; | ||||
| 
 | ||||
| 
 | ||||
| export class ExampleNode implements INodeType { | ||||
| 	description: INodeTypeDescription = { | ||||
| 		displayName: 'Example Node', | ||||
| 		name: 'exampleNode', | ||||
| 		group: ['transform'], | ||||
| 		version: 1, | ||||
| 		description: 'Basic Example Node', | ||||
| 		defaults: { | ||||
| 			name: 'Example Node', | ||||
| 			color: '#772244', | ||||
| 		}, | ||||
| 		inputs: ['main'], | ||||
| 		outputs: ['main'], | ||||
| 		properties: [ | ||||
| 			// Node properties which the user gets displayed and
 | ||||
| 			// can change on the node.
 | ||||
| 			{ | ||||
| 				displayName: 'My String', | ||||
| 				name: 'myString', | ||||
| 				type: 'string', | ||||
| 				default: '', | ||||
| 				placeholder: 'Placeholder value', | ||||
| 				description: 'The description text', | ||||
| 			} | ||||
| 		] | ||||
| 	}; | ||||
| 
 | ||||
| 
 | ||||
| 	async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> { | ||||
| 
 | ||||
| 		const items = this.getInputData(); | ||||
| 
 | ||||
| 		let item: INodeExecutionData; | ||||
| 		let myString: string; | ||||
| 
 | ||||
| 		// Itterates over all input items and add the key "myString" with the
 | ||||
| 		// value the parameter "myString" resolves to.
 | ||||
| 		// (This could be a different value for each item in case it contains an expression)
 | ||||
| 		for (let itemIndex = 0; itemIndex < items.length; itemIndex++) { | ||||
| 			myString = this.getNodeParameter('myString', itemIndex, '') as string; | ||||
| 			item = items[itemIndex]; | ||||
| 
 | ||||
| 			item.json['myString'] = myString; | ||||
| 		} | ||||
| 
 | ||||
| 		return this.prepareOutputData(items); | ||||
| 
 | ||||
| 	} | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue