0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-30 22:34:10 -05:00

feat: fastify search endpoint v1 without auth and format (#2432)

This commit is contained in:
Juan Picado 2021-09-12 17:12:47 +02:00 committed by GitHub
parent 60d7b35d88
commit e50410a875
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,12 +3,22 @@
import { logger } from '@verdaccio/logger';
async function searchRoute(fastify) {
fastify.get('/-/v1/search', async () => {
fastify.get('/-/v1/search', async (request, reply) => {
// TODO: apply security layer here like in
// packages/api/src/v1/search.ts
// TODO: add validations for query, some parameters are mandatory
// TODO: review which query fields are mandatory
const { url, query } = request;
const storage = fastify.storage;
const data = await storage.searchManager?.search({
query: query,
url: url,
});
logger.http('search endpoint');
// @ts-ignore
console.log('-storage->', fastify.storage);
console.log('-config->', fastify.config);
return {};
reply.code(200).send(data);
});
}