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.
		
		
		
		
		
			
		
			
				
					28 lines
				
				423 B
			
		
		
			
		
	
	
					28 lines
				
				423 B
			| 
								 
											3 years ago
										 
									 | 
							
								// works on Node v14.13.0+
							 | 
						||
| 
								 | 
							
								import { fastify } from '../fastify.js'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const app = fastify({
							 | 
						||
| 
								 | 
							
								  logger: true
							 | 
						||
| 
								 | 
							
								})
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const schema = {
							 | 
						||
| 
								 | 
							
								  schema: {
							 | 
						||
| 
								 | 
							
								    response: {
							 | 
						||
| 
								 | 
							
								      200: {
							 | 
						||
| 
								 | 
							
								        type: 'object',
							 | 
						||
| 
								 | 
							
								        properties: {
							 | 
						||
| 
								 | 
							
								          hello: {
							 | 
						||
| 
								 | 
							
								            type: 'string'
							 | 
						||
| 
								 | 
							
								          }
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								      }
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								app.get('/', schema, async function (req, reply) {
							 | 
						||
| 
								 | 
							
								  return { hello: 'world' }
							 | 
						||
| 
								 | 
							
								})
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								app.listen(3000).catch(console.error)
							 |