Define endpoint in TSy way
This commit is contained in:
parent
3160923f7e
commit
e2a4335937
@ -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);
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user