diff --git a/src/routes/names/+server.ts b/src/routes/names/+server.ts index c0adecf..6c7a633 100644 --- a/src/routes/names/+server.ts +++ b/src/routes/names/+server.ts @@ -1,12 +1,11 @@ import { storagePath } from '$lib'; import { json } from '@sveltejs/kit'; import { readdirSync, statSync } from 'fs'; +import type { RequestHandler } from './$types'; -export function GET() { - const names = readdirSync(storagePath).filter((f) => - statSync(`${storagePath}/${f}`).isDirectory() - ); - names.sort(); +export const GET: RequestHandler = () => { + let names = readdirSync(storagePath).filter((f) => statSync(`${storagePath}/${f}`).isDirectory()); + names = names.toSorted(); return json(names); -} +};