-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
41 lines (36 loc) · 1.1 KB
/
app.js
File metadata and controls
41 lines (36 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require('dotenv').config()
const express = require("express");
const SearchkitExpress = require("searchkit-express")
const bodyParser = require("body-parser");
const cors = require("cors")
const port = 4000
// initialize express
const app = express();
// support cors
app.use(cors());
app.use(bodyParser.json())
let searchkitRouter = SearchkitExpress.createRouter({
host:process.env.ELASTIC_URL || "http://localhost:9200",
index:'nfts',
maxSockets:500, // defaults to 1000
queryProcessor: function (query, req, res) {
// Add the 'highlight' property to the query
query = {
...query,
highlight: {
pre_tags: ['<span class="highlight">'],
post_tags: ['</span>'],
fields: {
"caption_model_vit_l_14_openai_f1": {},
"caption_model_vit_l_14_openai": {}
}
}
};
// console.log(query);
return query;
}
})
app.use("/nfts", searchkitRouter)
app.listen(port, () => {
console.log(`NFT Indexer Router listening on port ${port}`)
})