blob: 634adb50ee04272619a96701b3538ddf43d3459a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import axios from 'axios'
export default async function handler(req, res) {
const { q = '' } = req.query
let result = await axios(
process.env.SOLR_HOST +
`/solr/product/spell?indent=true&q.op=AND&q=${q}`
)
try {
res.status(200).json(result.data)
} catch (error) {
res.status(400).json({
numFound: 0,
suggestions: []
})
}
}
|