mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-03-06 12:11:02 +01:00
Merge branch 'pr/18' into 0.2.3
This commit is contained in:
@@ -7,11 +7,14 @@ var users = require('../../app/controllers/users'),
|
||||
articles = require('../../app/controllers/articles');
|
||||
|
||||
module.exports = function(app) {
|
||||
// Article Routes
|
||||
app.get('/articles', articles.list);
|
||||
app.post('/articles', users.requiresLogin, articles.create);
|
||||
app.get('/articles/:articleId', articles.read);
|
||||
app.put('/articles/:articleId', users.requiresLogin, articles.hasAuthorization, articles.update);
|
||||
// Article Routes, using express 4.x syntax
|
||||
app.route('/articles')
|
||||
.get(articles.list)
|
||||
.post(users.requiresLogin, articles.create);
|
||||
|
||||
app.route('/articles/:articleId')
|
||||
.get(articles.read)
|
||||
.put(users.requiresLogin, articles.hasAuthorization, articles.update);
|
||||
app.del('/articles/:articleId', users.requiresLogin, articles.hasAuthorization, articles.delete);
|
||||
|
||||
// Finish by binding the article middleware
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
module.exports = function(app) {
|
||||
// Root routing
|
||||
var core = require('../../app/controllers/core');
|
||||
app.get('/', core.index);
|
||||
app.route('/')
|
||||
.get(core.index);
|
||||
};
|
||||
@@ -4,8 +4,14 @@
|
||||
* Module dependencies.
|
||||
*/
|
||||
var express = require('express'),
|
||||
morgan = require('morgan'),
|
||||
bodyParser = require('body-parser'),
|
||||
session = require('express-session'),
|
||||
compress = require('compression'),
|
||||
methodOverride = require('method-override'),
|
||||
cookieParser = require('cookie-parser'),
|
||||
passport = require('passport'),
|
||||
mongoStore = require('connect-mongo')(express),
|
||||
mongoStore = require('connect-mongo')(session),
|
||||
flash = require('connect-flash'),
|
||||
config = require('./config'),
|
||||
consolidate = require('consolidate'),
|
||||
@@ -22,14 +28,12 @@ module.exports = function(db) {
|
||||
});
|
||||
|
||||
// Setting the environment locals
|
||||
app.locals({
|
||||
title: config.app.title,
|
||||
description: config.app.description,
|
||||
keywords: config.app.keywords,
|
||||
facebookAppId: config.facebook.clientID,
|
||||
modulesJSFiles: utilities.walk('./public/modules', /(.*)\.(js)/, /(.*)\.(spec.js)/, './public'),
|
||||
modulesCSSFiles: utilities.walk('./public/modules', /(.*)\.(css)/, null, './public')
|
||||
});
|
||||
app.locals.title = config.app.title;
|
||||
app.locals.description = config.app.description;
|
||||
app.locals.keywords = config.app.keywords;
|
||||
app.locals.facebookAppId = config.facebook.clientID;
|
||||
app.locals.modulesJSFiles = utilities.walk('./public/modules', /(.*)\.(js)/, /(.*)\.(spec.js)/, './public');
|
||||
app.locals.modulesCSSFiles = utilities.walk('./public/modules', /(.*)\.(css)/, null, './public');
|
||||
|
||||
// Passing the request url to environment locals
|
||||
app.use(function(req, res, next) {
|
||||
@@ -38,7 +42,7 @@ module.exports = function(db) {
|
||||
});
|
||||
|
||||
// Should be placed before express.static
|
||||
app.use(express.compress({
|
||||
app.use(compress({
|
||||
filter: function(req, res) {
|
||||
return (/json|text|javascript|css/).test(res.getHeader('Content-Type'));
|
||||
},
|
||||
@@ -55,35 +59,33 @@ module.exports = function(db) {
|
||||
app.set('view engine', 'html');
|
||||
app.set('views', config.root + '/app/views');
|
||||
|
||||
// Application Configuration for development environment
|
||||
app.configure('development', function() {
|
||||
// Enable logger
|
||||
app.use(express.logger('dev'));
|
||||
// Environment dependent middleware
|
||||
if (process.env.NODE_ENV === 'development'){
|
||||
// Enable logger (morgan)
|
||||
app.use(morgan('dev'));
|
||||
|
||||
// Disable views cache
|
||||
app.set('view cache', false);
|
||||
});
|
||||
|
||||
// Application Configuration for production environment
|
||||
app.configure('production', function() {
|
||||
} else if (process.env.NODE_ENV === 'production'){
|
||||
app.locals({
|
||||
cache: 'memory' // To solve SWIG Cache Issues
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// request body parsing middleware should be above methodOverride
|
||||
app.use(express.urlencoded());
|
||||
app.use(express.json());
|
||||
app.use(express.methodOverride());
|
||||
app.use(bodyParser.urlencoded());
|
||||
app.use(bodyParser.json());
|
||||
app.use(methodOverride());
|
||||
|
||||
// Enable jsonp
|
||||
app.enable('jsonp callback');
|
||||
|
||||
// cookieParser should be above session
|
||||
app.use(express.cookieParser());
|
||||
app.use(cookieParser());
|
||||
|
||||
// express/mongo session storage
|
||||
app.use(express.session({
|
||||
app.use(session({
|
||||
secret: config.sessionSecret,
|
||||
store: new mongoStore({
|
||||
db: db.connection.db,
|
||||
@@ -98,9 +100,6 @@ module.exports = function(db) {
|
||||
// connect flash for flash messages
|
||||
app.use(flash());
|
||||
|
||||
// routes should be at the last
|
||||
app.use(app.router);
|
||||
|
||||
// Setting the app router and static folder
|
||||
app.use(express.static(config.root + '/public'));
|
||||
|
||||
|
||||
117
package.json
117
package.json
@@ -1,56 +1,65 @@
|
||||
{
|
||||
"name": "meanjs",
|
||||
"description": "Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js.",
|
||||
"version": "0.2.2",
|
||||
"private": false,
|
||||
"author": "https://github.com/meanjs/mean/graphs/contributors",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/meanjs/mean.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.10.x",
|
||||
"npm": "1.4.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "grunt",
|
||||
"test": "grunt test",
|
||||
"postinstall": "bower install --config.interactive=false"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "~3.5.1",
|
||||
"consolidate": "~0.10.0",
|
||||
"swig": "~1.3.2",
|
||||
"mongoose": "~3.8.8",
|
||||
"connect-mongo": "~0.4.0",
|
||||
"connect-flash": "~0.1.1",
|
||||
"passport": "~0.2.0",
|
||||
"passport-local": "~1.0.0",
|
||||
"passport-facebook": "~1.0.2",
|
||||
"passport-twitter": "~1.0.2",
|
||||
"passport-linkedin": "~0.1.3",
|
||||
"passport-google-oauth": "~0.1.5",
|
||||
"lodash": "~2.4.1",
|
||||
"forever": "~0.10.11",
|
||||
"bower": "~1.3.1",
|
||||
"grunt-cli": "~0.1.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"supertest": "~0.10.0",
|
||||
"should": "~3.2.0",
|
||||
"grunt-env": "~0.4.1",
|
||||
"grunt-node-inspector": "~0.1.3",
|
||||
"grunt-contrib-watch": "~0.6.1",
|
||||
"grunt-contrib-jshint": "~0.10.0",
|
||||
"grunt-nodemon": "~0.2.0",
|
||||
"grunt-concurrent": "~0.5.0",
|
||||
"grunt-mocha-test": "~0.10.0",
|
||||
"grunt-karma": "~0.8.2",
|
||||
"karma": "~0.12.0",
|
||||
"karma-jasmine": "~0.2.1",
|
||||
"karma-coverage": "~0.2.0",
|
||||
"karma-chrome-launcher": "~0.1.2",
|
||||
"karma-firefox-launcher": "~0.1.3",
|
||||
"karma-phantomjs-launcher": "~0.1.2"
|
||||
}
|
||||
"name": "meanjs",
|
||||
"description": "Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js.",
|
||||
"version": "0.2.3",
|
||||
"private": false,
|
||||
"author": "https://github.com/meanjs/mean/graphs/contributors",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/meanjs/mean.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.10.x",
|
||||
"npm": "1.4.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "grunt",
|
||||
"test": "grunt test",
|
||||
"postinstall": "bower install --config.interactive=false"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "^1.0.1",
|
||||
"bower": "~1.3.1",
|
||||
"compression": "^1.0.1",
|
||||
"connect-flash": "~0.1.1",
|
||||
"connect-mongo": "mrzepinski/connect-mongo#2135988",
|
||||
"consolidate": "~0.10.0",
|
||||
"cookie-parser": "^1.0.1",
|
||||
"express": "4.x",
|
||||
"express-session": "^1.0.2",
|
||||
"forever": "~0.10.11",
|
||||
"grunt-cli": "~0.1.13",
|
||||
"grunt-mocha-test": "^0.10.2",
|
||||
"karma-jasmine": "^0.2.2",
|
||||
"lodash": "~2.4.1",
|
||||
"method-override": "^1.0.0",
|
||||
"mongoose": "~3.8.8",
|
||||
"morgan": "^1.0.0",
|
||||
"passport": "~0.2.0",
|
||||
"passport-facebook": "~1.0.2",
|
||||
"passport-google-oauth": "~0.1.5",
|
||||
"passport-linkedin": "~0.1.3",
|
||||
"passport-local": "~1.0.0",
|
||||
"passport-twitter": "~1.0.2",
|
||||
"should": "^3.2.0",
|
||||
"swig": "~1.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"supertest": "~0.10.0",
|
||||
"should": "~3.2.0",
|
||||
"grunt-env": "~0.4.1",
|
||||
"grunt-node-inspector": "~0.1.3",
|
||||
"grunt-contrib-watch": "~0.6.1",
|
||||
"grunt-contrib-jshint": "~0.10.0",
|
||||
"grunt-nodemon": "~0.2.0",
|
||||
"grunt-concurrent": "~0.5.0",
|
||||
"grunt-mocha-test": "~0.10.0",
|
||||
"grunt-karma": "~0.8.2",
|
||||
"karma": "~0.12.0",
|
||||
"karma-jasmine": "~0.2.1",
|
||||
"karma-coverage": "~0.2.0",
|
||||
"karma-chrome-launcher": "~0.1.2",
|
||||
"karma-firefox-launcher": "~0.1.3",
|
||||
"karma-phantomjs-launcher": "~0.1.2"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user