mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 02:42:48 +00:00
updated bunch of file paths and changed the way posts are loaded
This commit is contained in:
15
node_modules/mongo-express/routes/document.js
generated
vendored
15
node_modules/mongo-express/routes/document.js
generated
vendored
@@ -9,12 +9,23 @@ var routes = function(config) {
|
||||
var ctx = {
|
||||
title: 'Viewing Document: ' + req.document._id,
|
||||
editorTheme: config.options.editorTheme,
|
||||
docString: bson.toString(req.document)
|
||||
docString: bson.toString(req.document),
|
||||
};
|
||||
|
||||
res.render('document', ctx);
|
||||
};
|
||||
|
||||
exp.checkValid = function(req, res) {
|
||||
var doc = req.body.document;
|
||||
try {
|
||||
bson.toBSON(doc);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
return res.send('Invalid');
|
||||
}
|
||||
|
||||
res.send('Valid');
|
||||
};
|
||||
|
||||
exp.addDocument = function(req, res) {
|
||||
var doc = req.body.document;
|
||||
@@ -46,7 +57,6 @@ var routes = function(config) {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
exp.updateDocument = function(req, res) {
|
||||
var doc = req.body.document;
|
||||
|
||||
@@ -79,7 +89,6 @@ var routes = function(config) {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
exp.deleteDocument = function(req, res) {
|
||||
req.collection.remove(req.document, {safe: true}, function(err) {
|
||||
if (err) {
|
||||
|
||||
Reference in New Issue
Block a user