Files
fredy/lib/api/routes/providerRouter.js

19 lines
562 B
JavaScript
Raw Permalink Normal View History

2025-12-11 10:40:55 +01:00
/*
* Copyright (c) 2026 by Christian Kellner.
2025-12-11 10:40:55 +01:00
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
*/
import fs from 'fs';
2026-04-27 16:56:04 +02:00
const providerList = fs.readdirSync('./lib/provider').filter((file) => file.endsWith('.js'));
2026-04-27 16:56:04 +02:00
const providers = await Promise.all(providerList.map(async (pro) => import(`../../provider/${pro}`)));
/**
* @param {import('fastify').FastifyInstance} fastify
*/
export default async function providerPlugin(fastify) {
fastify.get('/', async () => {
return providers.map((p) => p.metaInformation);
});
}