You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					20 lines
				
				510 B
			
		
		
			
		
	
	
					20 lines
				
				510 B
			| 
								 
											3 years ago
										 
									 | 
							
								import fastify from 'fastify'
							 | 
						||
| 
								 | 
							
								import querystring from 'querystring'
							 | 
						||
| 
								 | 
							
								import formBodyPlugin, { FormBodyPluginOptions } from './formbody'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const app = fastify()
							 | 
						||
| 
								 | 
							
								app.register(formBodyPlugin)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const emptyOpts: FormBodyPluginOptions = {}
							 | 
						||
| 
								 | 
							
								app.register(formBodyPlugin, emptyOpts)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const bodyLimitOpts: FormBodyPluginOptions = {
							 | 
						||
| 
								 | 
							
								  bodyLimit: 1000
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								app.register(formBodyPlugin, bodyLimitOpts)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const parserOpts: FormBodyPluginOptions = {
							 | 
						||
| 
								 | 
							
								  parser: (s) => querystring.parse(s)
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								app.register(formBodyPlugin, parserOpts)
							 |