Improved server and urls

This commit is contained in:
Thomas FORGIONE 2015-05-06 16:32:00 +02:00
parent 3f9b02e3d4
commit 3cc8e15aaa
3 changed files with 20 additions and 9 deletions

View File

@ -1,25 +1,25 @@
extends ../../../views/main extends ../../../views/main
block title block title
title 3DUI - Index title #{title} - Index
block content block content
h2 Index h2 Index
ul ul
li li
a(href="/bouncing/") A bouncing cube that jumps when you click on it a(href="#{urls.bouncing}") A bouncing cube that jumps when you click on it
p. p.
Jumps and bounce when you click on it. Jumps and bounce when you click on it.
li li
a(href="/multisphere/") Sphere with multi-resolution a(href="#{urls.multisphere}") Sphere with multi-resolution
p. p.
Lots of obj files loaded and displayed. When you click Lots of obj files loaded and displayed. When you click
somewhere, the current obj is hidden and the next one, with a somewhere, the current obj is hidden and the next one, with a
better resolution is shown. better resolution is shown.
li li
a(href="/prototype/") A proto of the real thing a(href="#{urls.prototype}") A proto of the real thing
p. p.
You can move the camera with the arrow keys and move the angle of You can move the camera with the arrow keys and move the angle of
the camera with 2, 4, 6 and 8 (the arrows of the numpad), or you the camera with 2, 4, 6 and 8 (the arrows of the numpad), or you
@ -31,7 +31,7 @@ block content
camera that you want, and move to it progressively. camera that you want, and move to it progressively.
li li
a(href="/stream/") Streaming simulation a(href="#{urls.stream}") Streaming simulation
p. p.
A mesh of a sphere is fully loaded, and displayed A mesh of a sphere is fully loaded, and displayed
progressively. This test is here to prove that we can progressively. This test is here to prove that we can

View File

@ -4,7 +4,6 @@ var module = require('./my_modules/filterInt');
var jade = require('jade'); var jade = require('jade');
var app = express(); var app = express();
var urls = require('./urls'); var urls = require('./urls');
app.set('view engine', 'jade'); app.set('view engine', 'jade');
@ -20,6 +19,7 @@ require('./lib/boot')(app, { verbose: !module.parent });
app.use('/static', express.static('static')); app.use('/static', express.static('static'));
// When error raised
app.use(function(err, req, res, next) { app.use(function(err, req, res, next) {
if (err.status === 404) { if (err.status === 404) {
res.setHeader('Content-Type', 'text/html'); res.setHeader('Content-Type', 'text/html');
@ -30,6 +30,7 @@ app.use(function(err, req, res, next) {
} }
}); });
// When route not found, raise not found
app.use(function(req, res) { app.use(function(req, res) {
res.setHeader('Content-Type', 'text/html'); res.setHeader('Content-Type', 'text/html');
@ -38,4 +39,14 @@ app.use(function(req, res) {
}); });
}); });
app.listen(4000); // Set ports and ip adress
var server_port, server_ip_adress;
if ( app.get('env') === 'development' ) {
server_port = 4000;
server_ip_adress = 'localhost';
} else {
server_port = process.env.OPENSHIFT_NODEJS_PORT || 8080;
server_ip_address = process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1';
}
app.listen(server_port, server_ip_adress);

View File

@ -16,10 +16,10 @@ html(lang='fr')
.container .container
.navbar-header .navbar-header
button.navbar-toggle(type="button", data-toggle="collapse" data-target=".navbar-collapse") button.navbar-toggle(type="button", data-toggle="collapse" data-target=".navbar-collapse")
span.sr-only Tootle navigation span.sr-only Toggle navigation
span.icon-bar span.icon-bar
span.icon-bar span.icon-bar
a.navbar-brand(href="/") 3DUI a.navbar-brand(href="#{urls.index}") 3DUI
div.navbar-collapse.collapse div.navbar-collapse.collapse
ul.nav.navbar-nav ul.nav.navbar-nav