added templates support
This commit is contained in:
parent
ec84478184
commit
c706deff2f
@ -4,19 +4,23 @@
|
|||||||
* Module dependencies.
|
* Module dependencies.
|
||||||
*/
|
*/
|
||||||
var express = require('express'),
|
var express = require('express'),
|
||||||
config = require('./config');
|
helpers = require('view-helpers'),
|
||||||
|
config = require('./config')
|
||||||
|
path = require('path');
|
||||||
|
|
||||||
module.exports = function(app, historicSync, peerSync) {
|
module.exports = function(app, historicSync, peerSync) {
|
||||||
|
|
||||||
//custom middleware
|
|
||||||
function setHistoric(req, res, next) {
|
//custom middleware
|
||||||
|
var setHistoric = function(req, res, next) {
|
||||||
req.historicSync = historicSync;
|
req.historicSync = historicSync;
|
||||||
next();
|
next();
|
||||||
}
|
};
|
||||||
function setPeer(req, res, next) {
|
|
||||||
|
var setPeer = function(req, res, next) {
|
||||||
req.peerSync = peerSync;
|
req.peerSync = peerSync;
|
||||||
next();
|
next();
|
||||||
}
|
};
|
||||||
|
|
||||||
app.set('showStackError', true);
|
app.set('showStackError', true);
|
||||||
|
|
||||||
@ -34,6 +38,13 @@ module.exports = function(app, historicSync, peerSync) {
|
|||||||
app.use(express.methodOverride());
|
app.use(express.methodOverride());
|
||||||
app.use(express.compress());
|
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
|
// manual helpers
|
||||||
app.use(function(req, res, next) {
|
app.use(function(req, res, next) {
|
||||||
app.locals.config = config;
|
app.locals.config = config;
|
||||||
|
|||||||
@ -85,7 +85,7 @@ require('./app/controllers/socket.js').init(expressApp, ios);
|
|||||||
|
|
||||||
//Start the app by listening on <port>
|
//Start the app by listening on <port>
|
||||||
server.listen(config.port, function(){
|
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
|
//expose app
|
||||||
|
|||||||
10
package.json
10
package.json
@ -6,7 +6,7 @@
|
|||||||
"name": "Ryan X Charles",
|
"name": "Ryan X Charles",
|
||||||
"email": "ryan@bitpay.com"
|
"email": "ryan@bitpay.com"
|
||||||
},
|
},
|
||||||
"repository": "git://github.com/bitpay/insight.git",
|
"repository": "git://github.com/bitpay/insight-api.git",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
{
|
{
|
||||||
"name": "Matias Alejo Garcia",
|
"name": "Matias Alejo Garcia",
|
||||||
@ -30,9 +30,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bugs": {
|
"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",
|
"license": "MIT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"insight",
|
"insight",
|
||||||
@ -41,7 +41,9 @@
|
|||||||
"riddle",
|
"riddle",
|
||||||
"mystification",
|
"mystification",
|
||||||
"puzzle",
|
"puzzle",
|
||||||
"conundrum"
|
"conundrum",
|
||||||
|
"api",
|
||||||
|
"bitcore"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "*"
|
"node": "*"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user