@eas-framework/server
Version:
Node.js framework, with a lot of built in features
1 lines • 696 B
JavaScript
module.exports=async require=>{var module1={exports:{}},exports=module1.exports;var{SearchRecord}=await require("@eas-framework/server");const docSearch=new SearchRecord("records/search.serv");await docSearch.load();const mapResult=d=>d.map(x=>({text:x.text,link:x.link}));exports.default={GET:{define:{query:String},count:{define:{number:Number},func(Request,Response,_,{query,number}){return Math.min(number,mapResult(docSearch.search(query,{length:15})).length)}},first:{func(Request,Response,_,{query}){return mapResult(docSearch.search(query,{length:15})).pop()||"Not found"}},func(Request,Response,_,{query}){return mapResult(docSearch.search(query,{length:15}))}}};return module1.exports};