switch search function to typesense search
This commit is contained in:
27
genkey.js
Normal file
27
genkey.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const http = require('https');
|
||||
|
||||
const data = JSON.stringify({
|
||||
"description": "Public search only key",
|
||||
"actions": ["documents:search"],
|
||||
"collections": ["blogs"]
|
||||
});
|
||||
|
||||
const options = {
|
||||
hostname: 'typesense.biss.click', // 不要带 https://
|
||||
port: 443,
|
||||
path: '/keys',
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-TYPESENSE-API-KEY': 'tDPfzkghH3Zy55DHyWOnYkQiijOqN8bx',
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Length': data.length
|
||||
}
|
||||
};
|
||||
|
||||
const req = http.request(options, res => {
|
||||
res.on('data', d => { process.stdout.write(d); });
|
||||
});
|
||||
|
||||
req.on('error', error => { console.error(error); });
|
||||
req.write(data);
|
||||
req.end();
|
||||
Reference in New Issue
Block a user