File tree 2 files changed +11
-1
lines changed
apps/www/src/app/api/registry/[name]
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,23 @@ import { z } from 'zod';
3
3
4
4
import { highlightFiles } from '@/lib/highlight-code' ;
5
5
import { getRegistryItem } from '@/lib/registry' ;
6
+ import { registry } from '@/registry/registry' ;
7
+
8
+ export const dynamic = 'force-static' ;
6
9
7
10
const ParamsSchema = z . object ( {
8
11
name : z . string ( ) . min ( 1 , 'Name parameter is required' ) ,
9
12
} ) ;
10
13
14
+ export function generateStaticParams ( ) {
15
+ return registry . map ( ( { name } ) => ( {
16
+ name,
17
+ } ) ) ;
18
+ }
19
+
11
20
export async function GET ( _ : Request , { params } : any ) {
12
21
try {
13
- const { name } = ParamsSchema . parse ( { name : params . name } ) ;
22
+ const { name } = ParamsSchema . parse ( { name : ( await params ) . name } ) ;
14
23
15
24
const item = await getRegistryItem ( name ) ;
16
25
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ module.exports = {
27
27
'unicorn/no-array-callback-reference' : 'off' ,
28
28
'unicorn/no-array-for-each' : 'off' ,
29
29
'unicorn/no-array-reduce' : 'off' ,
30
+ 'unicorn/no-await-expression-member' : 'off' ,
30
31
'unicorn/no-document-cookie' : 'off' ,
31
32
'unicorn/no-for-loop' : 'off' ,
32
33
'unicorn/no-null' : 'off' ,
You can’t perform that action at this time.
0 commit comments