Add support for vercel search

This commit is contained in:
Ole Eskild Steensen 2023-01-22 23:29:14 +01:00
parent 44a7af447c
commit f537472f5d
4 changed files with 15 additions and 1 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ src/site/styles/_theme.*.css
.netlify .netlify
.idea/ .idea/
.vercel .vercel
**/.DS_Store

11
api/search.js Normal file
View File

@ -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;

View File

@ -49,6 +49,7 @@
"src/helpers/utils.js", "src/helpers/utils.js",
"src/helpers/linkUtils.js", "src/helpers/linkUtils.js",
"netlify/functions/search/search.js", "netlify/functions/search/search.js",
"src/site/get-theme.js" "src/site/get-theme.js",
"api/search.js"
] ]
} }

View File

@ -2,6 +2,7 @@
"outputDirectory": "dist", "outputDirectory": "dist",
"installCommand": "npm install", "installCommand": "npm install",
"buildCommand": "npm run build", "buildCommand": "npm run build",
"devCommand": "npm run start",
"routes": [ "routes": [
{ "handle": "filesystem" }, { "handle": "filesystem" },
{ "src": "/(.*)", "status": 404, "dest": "/404" } { "src": "/(.*)", "status": 404, "dest": "/404" }