Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
|
@@ -8,10 +8,9 @@ app.use(express.json());
|
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
async function getcreds() {
|
| 14 |
|
|
|
|
| 15 |
let request=await fetch("https://immutablehub-creds.hf.space/creds",{
|
| 16 |
mode:"cors",
|
| 17 |
method:"get",
|
|
@@ -47,7 +46,7 @@ const aclient = algoliasearch('D79SNO8B1R', '5e28f0f65380b998763c5251289f6d9b');
|
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
-
async function SavetoAlgolia(raw){
|
| 51 |
|
| 52 |
|
| 53 |
//const raw = fs.readFileSync("./package.json","utf8");
|
|
@@ -60,12 +59,12 @@ async function SavetoAlgolia(raw){
|
|
| 60 |
author: pkg.author,
|
| 61 |
license: pkg.license,
|
| 62 |
version: pkg.version,
|
| 63 |
-
readme:`ihub op clone <
|
| 64 |
};
|
| 65 |
|
| 66 |
|
| 67 |
let algolia_insertion=await aclient.saveObject({
|
| 68 |
-
indexName:
|
| 69 |
body: meta
|
| 70 |
});
|
| 71 |
if(algolia_insertion.taskID){
|
|
@@ -96,7 +95,7 @@ async function SavetoAlgoliaIPM(raw){
|
|
| 96 |
author: pkg.author,
|
| 97 |
license: pkg.license,
|
| 98 |
version: pkg.version,
|
| 99 |
-
readme:`ihub op clone <
|
| 100 |
};
|
| 101 |
|
| 102 |
|
|
@@ -156,8 +155,8 @@ app.get('/creds',async (req,res)=>{
|
|
| 156 |
|
| 157 |
app.post('/algolia',async (req,res)=>{
|
| 158 |
|
| 159 |
-
let {meta}=req.body
|
| 160 |
-
let response=await SavetoAlgolia(meta)
|
| 161 |
res.json({"response":response})
|
| 162 |
|
| 163 |
})
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
|
|
|
|
|
|
|
| 11 |
async function getcreds() {
|
| 12 |
|
| 13 |
+
|
| 14 |
let request=await fetch("https://immutablehub-creds.hf.space/creds",{
|
| 15 |
mode:"cors",
|
| 16 |
method:"get",
|
|
|
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
+
async function SavetoAlgolia(raw,index){
|
| 50 |
|
| 51 |
|
| 52 |
//const raw = fs.readFileSync("./package.json","utf8");
|
|
|
|
| 59 |
author: pkg.author,
|
| 60 |
license: pkg.license,
|
| 61 |
version: pkg.version,
|
| 62 |
+
readme:`ihub op clone < resource name >`
|
| 63 |
};
|
| 64 |
|
| 65 |
|
| 66 |
let algolia_insertion=await aclient.saveObject({
|
| 67 |
+
indexName: index
|
| 68 |
body: meta
|
| 69 |
});
|
| 70 |
if(algolia_insertion.taskID){
|
|
|
|
| 95 |
author: pkg.author,
|
| 96 |
license: pkg.license,
|
| 97 |
version: pkg.version,
|
| 98 |
+
readme:`ihub op clone <resource name>`
|
| 99 |
};
|
| 100 |
|
| 101 |
|
|
|
|
| 155 |
|
| 156 |
app.post('/algolia',async (req,res)=>{
|
| 157 |
|
| 158 |
+
let {meta, index }=req.body
|
| 159 |
+
let response=await SavetoAlgolia(meta,index)
|
| 160 |
res.json({"response":response})
|
| 161 |
|
| 162 |
})
|