diff --git a/.gitignore b/.gitignore index a2ddfa1..f461b08 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ src/site/styles/_theme.*.css .netlify .idea/ .vercel +**/.DS_Store diff --git a/api/search.js b/api/search.js new file mode 100644 index 0000000..9bd0ccc --- /dev/null +++ b/api/search.js @@ -0,0 +1,11 @@ +//vercel search function +const searchHandler = require('../netlify/functions/search/search.js').handler; +async function vercelSearch(request, response) { + let event = {queryStringParameters: request.query}; + + let searchResponse = await searchHandler(event); + + return response.status(200).json(JSON.parse(searchResponse.body)); + } + +exports.default = vercelSearch; \ No newline at end of file diff --git a/plugin-info.json b/plugin-info.json index ee6055d..4771d10 100644 --- a/plugin-info.json +++ b/plugin-info.json @@ -49,6 +49,7 @@ "src/helpers/utils.js", "src/helpers/linkUtils.js", "netlify/functions/search/search.js", - "src/site/get-theme.js" + "src/site/get-theme.js", + "api/search.js" ] } \ No newline at end of file diff --git a/vercel.json b/vercel.json index 1b32bb1..10e191a 100644 --- a/vercel.json +++ b/vercel.json @@ -2,6 +2,7 @@ "outputDirectory": "dist", "installCommand": "npm install", "buildCommand": "npm run build", + "devCommand": "npm run start", "routes": [ { "handle": "filesystem" }, { "src": "/(.*)", "status": 404, "dest": "/404" }