|
|
|
@ -62,12 +62,20 @@ var express = require('express'),
|
|
|
|
|
// Useful if you want to use app.put and app.delete (instead of app.post all the time)
|
|
|
|
|
// app.use(express.methodOverride());
|
|
|
|
|
|
|
|
|
|
app.get('/', function(req, res) {
|
|
|
|
|
global.modules.topics.generate_forum_body(function(forum_body) {
|
|
|
|
|
res.send(templates['header'] + forum_body + templates['footer']);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Basic Routes (entirely client-side parsed, goal is to move the rest of the crap in this file into this one section)
|
|
|
|
|
(function() {
|
|
|
|
|
var routes = ['', 'login', 'register'];
|
|
|
|
|
|
|
|
|
|
for (var i=0, ii=routes.length; i<ii; i++) {
|
|
|
|
|
(function(route) {
|
|
|
|
|
app.get('/' + route, function(req, res) {
|
|
|
|
|
res.send(templates['header'] + '<script>templates.ready(function(){ajaxify.go("' + route + '");});</script>' + templates['footer']);
|
|
|
|
|
});
|
|
|
|
|
}(routes[i]));
|
|
|
|
|
}
|
|
|
|
|
}());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function generate_topic_body(req, res) {
|
|
|
|
|
global.modules.topics.generate_topic_body(function(topic_body) {
|
|
|
|
@ -100,10 +108,6 @@ var express = require('express'),
|
|
|
|
|
app.get('/api/:method/:id', api_method);
|
|
|
|
|
app.get('/api/:method/:id*', api_method);
|
|
|
|
|
|
|
|
|
|
app.get('/login', function(req, res) {
|
|
|
|
|
res.send(templates['header'] + templates['login'] + templates['footer']);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.get('/logout', function(req, res) {
|
|
|
|
|
console.log('info: [Auth] Session ' + res.sessionID + ' logout (uid: ' + global.uid + ')');
|
|
|
|
|
global.modules.user.logout(req.sessionID, function(logout) {
|
|
|
|
@ -124,10 +128,6 @@ var express = require('express'),
|
|
|
|
|
res.send(templates['header'] + templates['reset'] + templates['footer']);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.get('/register', function(req, res) {
|
|
|
|
|
res.send(templates['header'] + templates['register'] + templates['footer']);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
app.get('/403', function(req, res) {
|
|
|
|
|
res.send(templates['header'] + templates['403'] + templates['footer']);
|
|
|
|
|
});
|
|
|
|
|