mirror of
https://github.com/vercel/commerce.git
synced 2025-07-27 04:01:23 +00:00
update to agility/next
This commit is contained in:
39
pages/api/bigcommerce/search-products.ts
Normal file
39
pages/api/bigcommerce/search-products.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
// import { NextApiRequest, NextApiResponse } from "next"
|
||||
// import getProducts from "../../shopify-api/get-products"
|
||||
|
||||
|
||||
|
||||
// const searchProducts = async (req:NextApiRequest, res:NextApiResponse) => {
|
||||
|
||||
// //cors stuff
|
||||
// res.setHeader('Access-Control-Allow-Credentials', "true")
|
||||
// res.setHeader('Access-Control-Allow-Origin', '*')
|
||||
// res.setHeader('Access-Control-Allow-Methods', 'GET,OPTIONS,PATCH,DELETE,POST,PUT')
|
||||
// res.setHeader(
|
||||
// 'Access-Control-Allow-Headers',
|
||||
// 'X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version'
|
||||
// )
|
||||
|
||||
// if (req.method === 'OPTIONS') {
|
||||
// res.status(200).end()
|
||||
// return
|
||||
// }
|
||||
|
||||
// try {
|
||||
// const filter = req.query.filter ?? ""
|
||||
|
||||
// const products = await getProducts({filter})
|
||||
|
||||
// res.statusCode = 200
|
||||
// res.json(products)
|
||||
|
||||
// } catch (e) {
|
||||
|
||||
// res.statusCode = 500
|
||||
// res.json({ message: "An error occurred ", error: e })
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// export default searchProducts
|
Reference in New Issue
Block a user