mirror of https://gitgud.io/fatchan/jschan.git
parent
345f948136
commit
279b3c2dd5
4 changed files with 0 additions and 77 deletions
@ -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…
Reference in new issue