HTTP route script with preprocessor template

Script windmill Verified

by hugo697 ยท 9/23/2024

The script

Submitted by hugo697 Bun
Verified 356 days ago
1

2
export async function preprocessor(
3
	event: {
4
		kind: 'http' | 'email' | 'webhook',
5
		http?: {
6
			route: string // The route path, e.g. "/users/:id"
7
			path: string // The actual path called, e.g. "/users/123"
8
			method: string
9
			params: Record<string, string>
10
			query: Record<string, string>
11
			headers: Record<string, string>
12
		}
13
	},
14
	/* your other args */ 
15
) {
16
  console.log(event)
17
	return {
18
		// return the args to be passed to the flow
19
	}
20
}
21

22

23
export async function main(
24
  /* main function args */
25
  a: string,
26
) {
27
  console.log('main')
28
  // Implement the main function logic here
29
}
30