10 lines
368 B
TypeScript
10 lines
368 B
TypeScript
import { error, json } from '@sveltejs/kit';
|
|
import { getBtopData } from '#lib/server/btop';
|
|
import type { RequestHandler } from './$types';
|
|
|
|
export const GET: RequestHandler = async () => {
|
|
const data = await getBtopData();
|
|
if (!data) error(503, 'System monitor data is unavailable');
|
|
return json(data, { headers: { 'Cache-Control': 'public, max-age=600' } });
|
|
};
|