Files
fredy/lib/api/routes/providerRouter.js
2026-04-27 16:56:04 +02:00

19 lines
562 B
JavaScript

/*
* Copyright (c) 2026 by Christian Kellner.
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
*/
import fs from 'fs';
const providerList = fs.readdirSync('./lib/provider').filter((file) => file.endsWith('.js'));
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);
});
}