Inputs a query, page and type and will search the bay for the query and return it as a json objec.t
This commit is contained in:
@@ -2,11 +2,11 @@
|
|||||||
* @Author: KevinMidboe
|
* @Author: KevinMidboe
|
||||||
* @Date: 2017-10-21 09:54:31
|
* @Date: 2017-10-21 09:54:31
|
||||||
* @Last Modified by: KevinMidboe
|
* @Last Modified by: KevinMidboe
|
||||||
* @Last Modified time: 2017-10-21 09:58:00
|
* @Last Modified time: 2017-10-21 12:12:26
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const PirateRepository = require('src/pirate/pirateRepository');
|
const PirateRepository = require('src/pirate/pirateRepository');
|
||||||
const pirateRepository = new PirateRepository();
|
// const pirateRepository = new PirateRepository();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller: Retrieves search history of a logged in user
|
* Controller: Retrieves search history of a logged in user
|
||||||
@@ -15,12 +15,11 @@ const pirateRepository = new PirateRepository();
|
|||||||
* @returns {Callback}
|
* @returns {Callback}
|
||||||
*/
|
*/
|
||||||
function updateRequested(req, res) {
|
function updateRequested(req, res) {
|
||||||
const id = req.params.requestName;
|
const { query, page, type } = req.query;
|
||||||
const type = req.body.type;
|
|
||||||
|
|
||||||
pirateRepository.search(id, type)
|
PirateRepository.SearchPiratebay(query, page, type)
|
||||||
.then(() => {
|
.then((result) => {
|
||||||
res.send({ success: true });
|
res.send({ success: true, torrents: result });
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
res.status(401).send({ success: false, error: error.message });
|
res.status(401).send({ success: false, error: error.message });
|
||||||
|
|||||||
Reference in New Issue
Block a user