summaryrefslogtreecommitdiff
path: root/src/pages/api/shop/suggest.js
blob: 6db1a8518843de25d2c7163d22f9303ccea79325 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import axios from "axios";

export default async function handler(req, res) {
  const { q } = req.query;

  let result = await axios(process.env.SOLR_HOST + `/solr/products/suggest?suggest=true&suggest.dictionary=mySuggester&suggest.q=${q}`);
  try {
    res.status(200).json(result.data);
  } catch (error) {
    res.status(400).json({ error: error.message });
  }
}