Skip to content

Commit

Permalink
added search router
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunlumbcgov committed Nov 17, 2023
1 parent a343bd2 commit dacd2aa
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions backend/src/routes/search-router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const express = require("express");
const router = express.Router();
const log = require("../components/logger");
const config = require("../config/index");
const NodeCache = require("node-cache");
const axios = require("axios");
const fs = require("fs");
const path = require("path");
const { checkToken } = require("../components/auth");
const { listCache } = require("../components/cache");
const {appendMailingAddressDetailsAndRemoveAddresses, rearrangeAndRelabelObjectProperties, sortByProperty} = require("../components/utils.js")
//Batch Routes
router.get("/*", checkToken, getSearchResults)
async function getSearchResults(req, res) {

const url = `${config.get("server:instituteAPIURL")}`+ req.url;
axios
.get(url, { headers: { Authorization: `Bearer ${req.accessToken}` } })
.then((response) => {
res.json(response.data);
})
.catch((e) => {
log.error("getData Error", e.response ? e.response.status : e.message);
});
}


module.exports = router;

0 comments on commit dacd2aa

Please sign in to comment.