File tree Expand file tree Collapse file tree 11 files changed +16
-72
lines changed
Expand file tree Collapse file tree 11 files changed +16
-72
lines changed Load Diff This file was deleted.
File renamed without changes.
Original file line number Diff line number Diff line change @@ -12,4 +12,4 @@ published: true
1212
1313Media inside the ** static** folder is served from ` / ` .
1414
15- ![ Svelte] ( favicon .png)
15+ ![ Svelte] ( test .png)
Original file line number Diff line number Diff line change 1- import type { Post } from '$lib/types' ;
1+ import type { Post } from '$lib/types/post ' ;
22
33export async function load ( { fetch } ) {
44 const response = await fetch ( '/api/posts' ) ;
Original file line number Diff line number Diff line change 33 import * as config from ' $lib/config' ;
44
55 let { data } = $props ();
6+ console .log (data );
67 </script >
78
89<svelte:head >
Original file line number Diff line number Diff line change 1+ <section class =" container" >
2+ <h1 class =" title" >About</h1 >
3+ <p class =" description" >This is About Page of SvelteKit!</p >
4+ </section >
Original file line number Diff line number Diff line change 11import { json } from '@sveltejs/kit' ;
2- import type { Post } from '$lib/types' ;
2+ import type { Post } from '$lib/types/post ' ;
33
44async function getPosts ( ) {
55 let posts : Post [ ] = [ ] ;
@@ -15,9 +15,7 @@ async function getPosts() {
1515 }
1616 }
1717
18- posts = posts . sort (
19- ( first , second ) => new Date ( second . date ) . getTime ( ) - new Date ( first . date ) . getTime ( )
20- ) ;
18+ posts = posts . sort ( byDescendingDate ) ;
2119
2220 return posts ;
2321}
@@ -26,3 +24,7 @@ export async function GET() {
2624 const posts = await getPosts ( ) ;
2725 return json ( posts ) ;
2826}
27+
28+ const byDescendingDate = ( firstPost : Post , secondPost : Post ) => {
29+ return new Date ( secondPost . date ) . getTime ( ) - new Date ( firstPost . date ) . getTime ( ) ;
30+ } ;
Original file line number Diff line number Diff line change 1212 <li >
1313 <a href =" /about" >About</a >
1414 </li >
15- <li >
16- <a href =" /tech" >Tech</a >
17- </li >
1815 <li >
1916 <a href =" /rss.xml" target =" _blank" >RSS</a >
2017 </li >
Original file line number Diff line number Diff line change 11import * as config from '$lib/config' ;
2- import type { Post } from '$lib/types' ;
3- export const prerender = true ;
2+ import type { Post } from '$lib/types/post' ;
43
54export async function GET ( { fetch } ) {
65 const response = await fetch ( '/api/posts' ) ;
You can’t perform that action at this time.
0 commit comments