Merge branch 'master' of github.com:nodebb/NodeBB
commit
699795621a
@ -1,60 +1,61 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var user = require('./../user'),
|
var express = require('express'),
|
||||||
|
user = require('./../user'),
|
||||||
categories = require('./../categories'),
|
categories = require('./../categories'),
|
||||||
topics = require('./../topics'),
|
topics = require('./../topics'),
|
||||||
posts = require('./../posts');
|
posts = require('./../posts');
|
||||||
|
|
||||||
module.exports = function(app, middleware, controllers) {
|
module.exports = function(app, middleware, controllers) {
|
||||||
app.namespace('/debug', function() {
|
var router = express.Router();
|
||||||
app.get('/uid/:uid', function (req, res) {
|
app.use('/debug', router);
|
||||||
if (!req.params.uid) {
|
router.get('/uid/:uid', function (req, res) {
|
||||||
return res.redirect('/404');
|
if (!req.params.uid) {
|
||||||
}
|
return res.redirect('/404');
|
||||||
|
}
|
||||||
|
|
||||||
user.getUserData(req.params.uid, function (err, data) {
|
user.getUserData(req.params.uid, function (err, data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
res.send(data);
|
res.send(data);
|
||||||
} else {
|
} else {
|
||||||
res.json(404, {
|
res.json(404, {
|
||||||
error: "User doesn't exist!"
|
error: "User doesn't exist!"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/cid/:cid', function (req, res) {
|
router.get('/cid/:cid', function (req, res) {
|
||||||
categories.getCategoryData(req.params.cid, function (err, data) {
|
categories.getCategoryData(req.params.cid, function (err, data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
res.send(data);
|
res.send(data);
|
||||||
} else {
|
} else {
|
||||||
res.send(404, "Category doesn't exist!");
|
res.send(404, "Category doesn't exist!");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/tid/:tid', function (req, res) {
|
router.get('/tid/:tid', function (req, res) {
|
||||||
topics.getTopicData(req.params.tid, function (err, data) {
|
topics.getTopicData(req.params.tid, function (err, data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
res.send(data);
|
res.send(data);
|
||||||
} else {
|
} else {
|
||||||
res.send(404, "Topic doesn't exist!");
|
res.send(404, "Topic doesn't exist!");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/pid/:pid', function (req, res) {
|
router.get('/pid/:pid', function (req, res) {
|
||||||
posts.getPostData(req.params.pid, function (err, data) {
|
posts.getPostData(req.params.pid, function (err, data) {
|
||||||
if (data) {
|
if (data) {
|
||||||
res.send(data);
|
res.send(data);
|
||||||
} else {
|
} else {
|
||||||
res.send(404, "Post doesn't exist!");
|
res.send(404, "Post doesn't exist!");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/test', function(req, res) {
|
router.get('/test', function(req, res) {
|
||||||
res.redirect('404');
|
res.redirect('404');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue