2013-08-29 05:45:19 +00:00
|
|
|
var nconf = require('nconf');
|
|
|
|
|
var express = require('express');
|
|
|
|
|
var router = new express.Router();
|
|
|
|
|
var _ = require('lodash');
|
2013-11-12 13:49:01 +00:00
|
|
|
var middleware = require('../middleware')
|
2013-08-29 05:45:19 +00:00
|
|
|
|
2013-09-01 16:56:43 +00:00
|
|
|
// -------- App --------
|
2013-11-12 14:57:46 +00:00
|
|
|
router.get('/', middleware.locals, function(req, res) {
|
2013-11-12 14:10:16 +00:00
|
|
|
if (!req.headers['x-api-user'] && !req.headers['x-api-key'] && !(req.session && req.session.userId))
|
|
|
|
|
return res.redirect('/static/front')
|
|
|
|
|
|
2013-08-29 05:45:19 +00:00
|
|
|
return res.render('index', {
|
|
|
|
|
title: 'HabitRPG | Your Life, The Role Playing Game',
|
2013-11-12 14:57:46 +00:00
|
|
|
env: res.locals.habitrpg
|
2013-08-29 05:45:19 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2013-09-01 16:56:43 +00:00
|
|
|
// -------- Marketing --------
|
|
|
|
|
|
2013-11-12 14:57:46 +00:00
|
|
|
router.get('/static/front', middleware.locals, function(req, res) {
|
2014-02-06 16:17:21 +00:00
|
|
|
res.render('static/front', {env: res.locals.habitrpg});
|
2013-09-01 16:56:43 +00:00
|
|
|
});
|
|
|
|
|
|
2013-11-12 14:57:46 +00:00
|
|
|
router.get('/static/privacy', middleware.locals, function(req, res) {
|
2014-02-11 17:44:22 +00:00
|
|
|
res.render('static/privacy', {env: res.locals.habitrpg});
|
2013-11-12 13:49:01 +00:00
|
|
|
});
|
|
|
|
|
|
2013-11-12 14:57:46 +00:00
|
|
|
router.get('/static/terms', middleware.locals, function(req, res) {
|
2014-02-11 17:44:22 +00:00
|
|
|
res.render('static/terms', {env: res.locals.habitrpg});
|
2013-11-12 13:49:01 +00:00
|
|
|
});
|
|
|
|
|
|
2014-01-01 21:20:01 +00:00
|
|
|
router.get('/static/api', middleware.locals, function(req, res) {
|
2014-02-11 17:44:22 +00:00
|
|
|
res.render('static/api', {env: res.locals.habitrpg});
|
2014-01-01 21:20:01 +00:00
|
|
|
});
|
|
|
|
|
|
2014-02-22 01:58:43 +00:00
|
|
|
router.get('/static/features', middleware.locals, function(req, res) {
|
|
|
|
|
res.render('static/features', {env: res.locals.habitrpg});
|
2013-09-01 16:56:43 +00:00
|
|
|
});
|
|
|
|
|
|
2014-02-11 07:51:29 +00:00
|
|
|
router.get('/static/videos', middleware.locals, function(req, res) {
|
2014-02-11 17:44:22 +00:00
|
|
|
res.render('static/videos', {env: res.locals.habitrpg});
|
2014-02-11 07:51:29 +00:00
|
|
|
});
|
|
|
|
|
|
2014-01-28 01:16:12 +00:00
|
|
|
router.get('/static/contact', middleware.locals, function(req, res) {
|
2014-02-11 17:44:22 +00:00
|
|
|
res.render('static/contact', {env: res.locals.habitrpg});
|
2013-09-01 16:56:43 +00:00
|
|
|
});
|
|
|
|
|
|
2014-01-28 02:24:24 +00:00
|
|
|
router.get('/static/plans', middleware.locals, function(req, res) {
|
2014-02-11 17:44:22 +00:00
|
|
|
res.render('static/plans', {env: res.locals.habitrpg});
|
2013-09-01 16:56:43 +00:00
|
|
|
});
|
|
|
|
|
|
2014-01-28 01:16:12 +00:00
|
|
|
// --------- Redirects --------
|
|
|
|
|
|
2013-09-01 16:56:43 +00:00
|
|
|
router.get('/static/extensions', function(req, res) {
|
2014-03-07 19:14:45 +00:00
|
|
|
res.redirect('http://habitrpg.wikia.com/wiki/App_and_Extension_Integrations');
|
2013-09-01 16:56:43 +00:00
|
|
|
});
|
|
|
|
|
|
2013-08-29 05:45:19 +00:00
|
|
|
module.exports = router;
|