Poszukiwacz/Serwer/Serwer.Api/Controllers/SearchController.cs

29 lines
744 B
C#
Raw Normal View History

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Serwer.Infrastructure.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Serwer.Api.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class SearchController : ControllerBase
{
private readonly ISearchService _searchService;
public SearchController(ISearchService searchService)
{
_searchService = searchService;
}
[HttpGet("{query}")]
public async Task<IActionResult> Search(string query)
{
var results = await _searchService.Search(query);
return Ok(results);
}
}
}