Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Sep 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 15 additions & 5 deletions packages/core/server/src/endpoints/search.ts
Expand Up @@ -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);
});
}

Expand Down