mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-19 23:31:38 +02:00
use consolidate to make template engine configurable
This commit is contained in:
3
config/env/all.js
vendored
3
config/env/all.js
vendored
@@ -7,10 +7,11 @@ module.exports = {
|
||||
root: rootPath,
|
||||
port: process.env.PORT || 3000,
|
||||
db: process.env.MONGOHQ_URL,
|
||||
templateEngine: 'jade',
|
||||
|
||||
// The secret should be set to a non-guessable string that
|
||||
// is used to compute a session hash
|
||||
sessionSecret: 'MEAN',
|
||||
// The name of the MongoDB collection to store sessions in
|
||||
sessionCollection: 'sessions'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Module dependencies.
|
||||
*/
|
||||
var express = require('express'),
|
||||
consolidate = require('consolidate'),
|
||||
mongoStore = require('connect-mongo')(express),
|
||||
flash = require('connect-flash'),
|
||||
helpers = require('view-helpers'),
|
||||
@@ -31,12 +32,17 @@ module.exports = function(app, passport, db) {
|
||||
app.use(express.logger('dev'));
|
||||
}
|
||||
|
||||
// assign the template engine to .html files
|
||||
app.engine('html', consolidate[config.templateEngine]);
|
||||
|
||||
// set .html as the default extension
|
||||
app.set('view engine', 'html');
|
||||
|
||||
// Set views path, template engine and default layout
|
||||
app.set('views', config.root + '/app/views');
|
||||
app.set('view engine', 'jade');
|
||||
|
||||
// Enable jsonp
|
||||
app.enable("jsonp callback");
|
||||
app.enable('jsonp callback');
|
||||
|
||||
app.configure(function() {
|
||||
// The cookieParser should be above session
|
||||
@@ -68,7 +74,7 @@ module.exports = function(app, passport, db) {
|
||||
|
||||
// Routes should be at the last
|
||||
app.use(app.router);
|
||||
|
||||
|
||||
// Setting the fav icon and static folder
|
||||
app.use(express.favicon());
|
||||
app.use(express.static(config.root + '/public'));
|
||||
@@ -90,7 +96,7 @@ module.exports = function(app, passport, db) {
|
||||
});
|
||||
|
||||
// Assume 404 since no middleware responded
|
||||
app.use(function(req, res, next) {
|
||||
app.use(function(req, res) {
|
||||
res.status(404).render('404', {
|
||||
url: req.originalUrl,
|
||||
error: 'Not found'
|
||||
@@ -98,4 +104,4 @@ module.exports = function(app, passport, db) {
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"dependencies": {
|
||||
"express": "~3.4.7",
|
||||
"jade": "~1.0.2",
|
||||
"consolidate": "~0.10.0",
|
||||
"mongoose": "~3.8.3",
|
||||
"connect-mongo": "~0.4.0",
|
||||
"connect-flash": "~0.1.1",
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<section data-ng-controller="ArticlesController" data-ng-init="findOne()">
|
||||
<span>{{article.created | date:'medium'}}</span>/
|
||||
<span>{{article.created | date:'medium'}}</span> /
|
||||
<span>{{article.user.name}}</span>
|
||||
<h2>{{article.title}}</h2>
|
||||
<div data-ng-show="global.user._id == article.user._id">
|
||||
<a class="btn" href="/#!/articles/{{article._id}}/edit">
|
||||
<i class="icon-edit"></i>
|
||||
</a>
|
||||
</a>
|
||||
<a class="btn" data-ng-click="remove();">
|
||||
<i class="icon-trash"></i>
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user