mirror of
				https://github.com/D4M13N-D3V/neroshitron.git
				synced 2025-11-04 11:35:35 +00:00 
			
		
		
		
	chore:(api-example)
This commit is contained in:
		
							parent
							
								
									43f98f0997
								
							
						
					
					
						commit
						58038e04cc
					
				
							
								
								
									
										20
									
								
								pages/api/example.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								pages/api/example.tsx
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					export default async function handler(req, res): Promise<any>  {
 | 
				
			||||||
 | 
					    let jsonString = generateRandomStringsAndJsonify(10, 5);
 | 
				
			||||||
 | 
					    console.log(jsonString);
 | 
				
			||||||
 | 
					    res.status(200).json(jsonString);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					function generateRandomStringsAndJsonify(length, stringLength) {
 | 
				
			||||||
 | 
					    let result = [];
 | 
				
			||||||
 | 
					    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (let i = 0; i < length; i++) {
 | 
				
			||||||
 | 
					        let randomString = '';
 | 
				
			||||||
 | 
					        for (let j = 0; j < stringLength; j++) {
 | 
				
			||||||
 | 
					            randomString += characters.charAt(Math.floor(Math.random() * characters.length));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        result.push(randomString);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return JSON.stringify(result);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user