summaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/api/shop/spell.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pages/api/shop/spell.js b/src/pages/api/shop/spell.js
new file mode 100644
index 00000000..634adb50
--- /dev/null
+++ b/src/pages/api/shop/spell.js
@@ -0,0 +1,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: []
+ })
+ }
+}