🚧 working on get-endpoint
This commit is contained in:
		
							parent
							
								
									43be8ac33e
								
							
						
					
					
						commit
						702e1d8458
					
				
					 3 changed files with 23 additions and 7 deletions
				
			
		|  | @ -0,0 +1,12 @@ | |||
| import { error } from '@sveltejs/kit'; | ||||
| 
 | ||||
| /** @type {import('./$types').PageServerLoad} */ | ||||
| export async function load({ params }) { | ||||
| 	const post = await getPostFromDatabase(params.slug); | ||||
| 
 | ||||
| 	if (post) { | ||||
| 		return post; | ||||
| 	} | ||||
| 
 | ||||
| 	error(404, 'Not found'); | ||||
| } | ||||
		Reference in a new issue
	
	 haraldnilsen
						haraldnilsen