remove old unused api stuff

merge-requests/208/head
fatchan 5 years ago
parent 345f948136
commit 279b3c2dd5
  1. 17
      models/api/get-boards.js
  2. 20
      models/api/get-catalog.js
  3. 20
      models/api/get-recent.js
  4. 20
      models/api/get-thread.js

@ -1,17 +0,0 @@
'use strict';
const Boards = require(__dirname+'/../../db-models/boards.js');
module.exports = async (req, res) => {
//get a list of boards
let boards;
try {
boards = await Boards.find();
} catch (err) {
console.error(err);
return res.status(500).json({ 'message': 'Error fetching from DB' })
}
//render the page
res.json(boards)
}

@ -1,20 +0,0 @@
'use strict';
const Posts = require(__dirname+'/../../db-models/posts.js');
module.exports = async (req, res) => {
//get the recently bumped thread & preview posts
let data;
try {
data = await Posts.getCatalog(req.params.board);
} catch (err) {
console.error(err);
return res.status(500).json({ 'message': 'Error fetching from DB' });
}
if (!data) {
return res.status(404).json({ 'message': 'Not found' });
}
return res.json(data)
}

@ -1,20 +0,0 @@
'use strict';
const Posts = require(__dirname+'/../../db-models/posts.js');
module.exports = async (req, res) => {
//get the recently bumped thread & preview posts
let threads;
try {
threads = await Posts.getRecent(req.params.board, req.params.page || 1);
} catch (err) {
console.error(err);
return res.status(500).json({ 'message': 'Error fetching from DB' });
}
if (!threads || threads.lenth === 0) {
return res.status(404).json({ 'message': 'Not found' });
}
return res.json(threads);
}

@ -1,20 +0,0 @@
'use strict';
const Posts = require(__dirname+'/../../db-models/posts.js');
module.exports = async (req, res) => {
//get the recently bumped thread & preview posts
let thread;
try {
thread = await Posts.getThread(req.params.board, req.params.id);
} catch (err) {
console.error(err);
return res.status(500).json({ 'message': 'Error fetching from DB' });
}
if (!thread) {
return res.status(404).json({ 'message': 'Not found' });
}
return res.json(thread)
}
Loading…
Cancel
Save