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:
parent
60d7b35d88
commit
e50410a875
1 changed files with 15 additions and 5 deletions
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue