Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 16x 16x 16x 16x 16x | import Crowi from 'server/crowi'
import ApiResponse from '../util/apiResponse'
export default (crowi: Crowi) => {
// var debug = Debug('crowi:routes:backlink')
const Backlink = crowi.model('Backlink')
const actions = {} as any
actions.api = {} as any
/**
* @api {list} /backlink.list Get list backlinks of the page
* @apiName ListBackLink
* @apiGroup Backlink
*
* @apiParam {String} page_id Page Id.
* @apiParam {Number} limit
* @apiParam {Number} offset
*/
actions.api.list = function(req, res) {
const pageId = req.query.page_id
const limit = req.query.limit || 10
const offset = req.query.offset || 0
Backlink.findByPageId(pageId, limit, offset)
.then(backlinks => {
var result = {
data: backlinks,
}
return res.json(ApiResponse.success(result))
})
.catch(err => {
return res.json(ApiResponse.error(err))
})
}
return actions
}
|