added templates support

This commit is contained in:
Mario Colque 2014-02-26 11:50:09 -03:00
parent ec84478184
commit c706deff2f
3 changed files with 24 additions and 11 deletions

View File

@ -4,19 +4,23 @@
* Module dependencies.
*/
var express = require('express'),
config = require('./config');
helpers = require('view-helpers'),
config = require('./config')
path = require('path');
module.exports = function(app, historicSync, peerSync) {
//custom middleware
function setHistoric(req, res, next) {
//custom middleware
var setHistoric = function(req, res, next) {
req.historicSync = historicSync;
next();
}
function setPeer(req, res, next) {
};
var setPeer = function(req, res, next) {
req.peerSync = peerSync;
next();
}
};
app.set('showStackError', true);
@ -34,6 +38,13 @@ module.exports = function(app, historicSync, peerSync) {
app.use(express.methodOverride());
app.use(express.compress());
if (process.env.INSIGHT_PUBLIC_PATH) {
var staticPath = path.normalize(config.rootPath + '/../../' + process.env.INSIGHT_PUBLIC_PATH);
//IMPORTANT: for html5mode, this line must to be before app.router
app.use(express.static(staticPath);
}
// manual helpers
app.use(function(req, res, next) {
app.locals.config = config;

View File

@ -85,7 +85,7 @@ require('./app/controllers/socket.js').init(expressApp, ios);
//Start the app by listening on <port>
server.listen(config.port, function(){
console.log('Express server listening on port %d in %s mode', server.address().port, process.env.NODE_ENV);
console.log('insight server listening on port %d in %s mode', server.address().port, process.env.NODE_ENV);
});
//expose app

View File

@ -6,7 +6,7 @@
"name": "Ryan X Charles",
"email": "ryan@bitpay.com"
},
"repository": "git://github.com/bitpay/insight.git",
"repository": "git://github.com/bitpay/insight-api.git",
"contributors": [
{
"name": "Matias Alejo Garcia",
@ -30,9 +30,9 @@
}
],
"bugs": {
"url": "https://github.com/bitpay/insight/issues"
"url": "https://github.com/bitpay/insight-api/issues"
},
"homepage": "https://github.com/bitpay/insight",
"homepage": "https://github.com/bitpay/insight-api",
"license": "MIT",
"keywords": [
"insight",
@ -41,7 +41,9 @@
"riddle",
"mystification",
"puzzle",
"conundrum"
"conundrum",
"api",
"bitcore"
],
"engines": {
"node": "*"