Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
use consolidate to make template engine configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
fyockm committed Jan 17, 2014
1 parent 02ff85a commit 412d6b3
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 8 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion config/env/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
};
16 changes: 11 additions & 5 deletions config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'));
Expand All @@ -90,12 +96,12 @@ 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'
});
});

});
};
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions public/views/articles/view.html
Original file line number Diff line number Diff line change
@@ -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>
Expand Down

0 comments on commit 412d6b3

Please sign in to comment.