”2016-04-22”

This commit is contained in:
Martin Donnelly 2016-04-22 16:45:04 +01:00
parent 37d345d2b7
commit 0bd723e3eb
2 changed files with 43 additions and 14 deletions

View File

@ -32,6 +32,30 @@ app.use('/export',express.static(path.join(__dirname,'server/static')));
app.use('/css',express.static(path.join(__dirname,'server/css')));
app.use('/',express.static(path.join(__dirname,'wwwroot')));
/* These next app.get's deal with ember's routing and when the user refreshes
the page. It forces the page back into the app.
*/
app.get('/about', function(request, response) {
response.redirect('/#/about');
});
app.get('/profile', function(request, response) {
response.redirect('/#/profile');
});
app.get('/company', function(request, response) {
response.redirect('/#/company');
});
app.get('/venue', function(request, response) {
response.redirect('/#/venue');
});
app.get('/pages', function(request, response) {
response.redirect('/#/pages');
});
console.log(path.join(__dirname,'server/static'));
var backend = globSync('./server/app/**/*.js', { cwd: __dirname }).map(require);

View File

@ -106,25 +106,30 @@ module.exports = function(app) {
});
});
pagesRouter.delete('/:id', function(req, res) {
logger.debug(req.params.id);
dbPages.deletePage(req.params.id)
.then(function(data) {
logger.debug('Delete...');
if (/Bearer .+/.test(req.headers.authorization)) {
logger.debug(req.params.id);
dbPages.deletePage(req.params.id)
.then(function(data) {
let response = {
data: data
};
res.status(200).send(response);
eventHandler.emit('renderPage', data.attributes);
let response = {
data: data
};
res.status(200).send(response);
})
.catch((err)=> {
console.error(err);
res.status(401).end();
});
})
.catch((err)=> {
console.error(err);
res.status(401).end();
});
} else {
res.status(401).end();
}
});
pagesRouter.get('/:id', function(req, res) {
logger.debug('Page to edit:', req.params.id);