正在显示
31 个修改的文件
包含
774 行增加
和
0 行删除
.gitignore
0 → 100644
1 | + | ||
2 | +# ------------------------------------------------------------------------------ | ||
3 | +# Common Node files and folders | ||
4 | +# https://github.com/github/gitignore/blob/master/Node.gitignore | ||
5 | +# ------------------------------------------------------------------------------ | ||
6 | + | ||
7 | +lib-cov | ||
8 | +*.seed | ||
9 | +*.log | ||
10 | +*.csv | ||
11 | +*.dat | ||
12 | +*.out | ||
13 | +*.pid | ||
14 | +*.gz | ||
15 | + | ||
16 | +pids | ||
17 | +logs | ||
18 | +results | ||
19 | + | ||
20 | +node_modules | ||
21 | +npm-debug.log | ||
22 | + | ||
23 | + | ||
24 | +# ------------------------------------------------------------------------------ | ||
25 | +# Nodemon | ||
26 | +# ------------------------------------------------------------------------------ | ||
27 | + | ||
28 | +.monitor | ||
29 | + | ||
30 | + | ||
31 | +# ------------------------------------------------------------------------------ | ||
32 | +# JSHint | ||
33 | +# ------------------------------------------------------------------------------ | ||
34 | + | ||
35 | +jshint | ||
36 | + | ||
37 | + | ||
38 | +# ------------------------------------------------------------------------------ | ||
39 | +# Numerous always-ignore extensions | ||
40 | +# ------------------------------------------------------------------------------ | ||
41 | + | ||
42 | +*.diff | ||
43 | +*.err | ||
44 | +*.orig | ||
45 | +*.rej | ||
46 | +*.swo | ||
47 | +*.swp | ||
48 | +*.vi | ||
49 | +*~ | ||
50 | +*.sass-cache | ||
51 | + | ||
52 | + | ||
53 | +# ------------------------------------------------------------------------------ | ||
54 | +# Files from other repository control systems | ||
55 | +# ------------------------------------------------------------------------------ | ||
56 | + | ||
57 | +.hg | ||
58 | +.svn | ||
59 | +.CVS | ||
60 | + | ||
61 | + | ||
62 | +# ------------------------------------------------------------------------------ | ||
63 | +# Your ideas | ||
64 | +# ------------------------------------------------------------------------------ | ||
65 | + | ||
66 | +.idea | ||
67 | + | ||
68 | + | ||
69 | +# ------------------------------------------------------------------------------ | ||
70 | +# OS X and other IDE's folder attributes | ||
71 | +# ------------------------------------------------------------------------------ | ||
72 | + | ||
73 | +.DS_Store | ||
74 | +Thumbs.db | ||
75 | +.cache | ||
76 | +.project | ||
77 | +.settings | ||
78 | +.tmproj | ||
79 | +*.esproj | ||
80 | +nbproject | ||
81 | +*.sublime-project | ||
82 | +*.sublime-workspace | ||
83 | + | ||
84 | + | ||
85 | +# ------------------------------------------------------------------------------ | ||
86 | +# Dreamweaver added files | ||
87 | +# ------------------------------------------------------------------------------ | ||
88 | + | ||
89 | +_notes | ||
90 | +dwsync.xml | ||
91 | + | ||
92 | + | ||
93 | +# ------------------------------------------------------------------------------ | ||
94 | +# Komodo | ||
95 | +# ------------------------------------------------------------------------------ | ||
96 | + | ||
97 | +*.komodoproject | ||
98 | +.komodotools | ||
99 | + | ||
100 | + | ||
101 | +# ------------------------------------------------------------------------------ | ||
102 | +# Add your custom excludes below | ||
103 | +# ------------------------------------------------------------------------------ |
.jshintrc
0 → 100644
1 | +{ | ||
2 | + "predef": [ | ||
3 | + "jasmine", | ||
4 | + "spyOn", | ||
5 | + "it", | ||
6 | + "console", | ||
7 | + "describe", | ||
8 | + "expect", | ||
9 | + "beforeEach", | ||
10 | + "waits", | ||
11 | + "waitsFor", | ||
12 | + "runs", | ||
13 | + "alert", | ||
14 | + "confirm", | ||
15 | + "Modernizr", | ||
16 | + "impress", | ||
17 | + "exports", | ||
18 | + "self", | ||
19 | + "define", | ||
20 | + "google" | ||
21 | + ], | ||
22 | + | ||
23 | + "node" : true, | ||
24 | + "es5" : false, | ||
25 | + "browser" : true, | ||
26 | + "jquery": true, | ||
27 | + | ||
28 | + "boss" : false, | ||
29 | + "curly": false, | ||
30 | + "debug": false, | ||
31 | + "devel": false, | ||
32 | + "eqeqeq": true, | ||
33 | + "evil": true, | ||
34 | + "forin": false, | ||
35 | + "immed": false, | ||
36 | + "laxbreak": true, | ||
37 | + "laxcomma": true, | ||
38 | + "newcap": true, | ||
39 | + "noarg": true, | ||
40 | + "noempty": false, | ||
41 | + "nonew": false, | ||
42 | + "nomen": false, | ||
43 | + "onevar": false, | ||
44 | + "plusplus": false, | ||
45 | + "regexp": false, | ||
46 | + "undef": true, | ||
47 | + "sub": true, | ||
48 | + "strict": false, | ||
49 | + "white": false, | ||
50 | + "asi": true | ||
51 | +} |
Gruntfile.js
0 → 100644
LICENSE
0 → 100644
1 | +The MIT License | ||
2 | + | ||
3 | +Copyright (c) 2014- Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/) | ||
4 | + | ||
5 | +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
6 | + | ||
7 | +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
8 | + | ||
9 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Readme.md
0 → 100644
1 | + | ||
2 | +# Igloo [![NPM version](https://badge.fury.io/js/igloo.png)](http://badge.fury.io/js/igloo) | ||
3 | + | ||
4 | +![Igloo](https://filenode.s3.amazonaws.com/igloo.png) | ||
5 | + | ||
6 | +Igloo is a minimal app boilerplate built with Express. | ||
7 | + | ||
8 | +View documentation for Igloo at <http://documentup.com/niftylettuce/igloo>. | ||
9 | + | ||
10 | + | ||
11 | +## Quick Start | ||
12 | + | ||
13 | +### Requirements | ||
14 | + | ||
15 | +* [Node](http://nodejs.org) | ||
16 | +* [Redis](http://redis.io/) | ||
17 | +* [MongoDB](http://www.mongodb.org/) | ||
18 | + | ||
19 | +### Installation | ||
20 | + | ||
21 | +* Install the `igloo` package from the NPM repository: | ||
22 | + | ||
23 | +```bash | ||
24 | +npm install -g igloo | ||
25 | +``` | ||
26 | + | ||
27 | +* Create a new igloo: | ||
28 | + | ||
29 | +```bash | ||
30 | +igloo [project] | ||
31 | +``` | ||
32 | + | ||
33 | +* Initialize it as a Git repository: | ||
34 | + | ||
35 | +```bash | ||
36 | +cd [project] | ||
37 | +git init | ||
38 | +``` | ||
39 | + | ||
40 | +* Install the NPM dependencies: | ||
41 | + | ||
42 | +```bash | ||
43 | +npm install | ||
44 | +``` | ||
45 | + | ||
46 | +* Enjoy your fresh new igloo. | ||
47 | + | ||
48 | +```bash | ||
49 | +node igloo | ||
50 | +``` | ||
51 | + | ||
52 | +```bash | ||
53 | +info: Igloo started at http://localhost:3000 | ||
54 | +``` | ||
55 | + | ||
56 | + | ||
57 | +## Contributors | ||
58 | + | ||
59 | +* Nick Baugh <niftylettuce@gmail.com> | ||
60 | + | ||
61 | + | ||
62 | +## Credits | ||
63 | + | ||
64 | +* [Igloo](http://thenounproject.com/term/igloo/26547/) by VALÈRE DAYAN from The Noun Project | ||
65 | +* [ESKIMO IGLOO](http://www.colourlovers.com/palette/1933518/ESKIMO_IGLOO) (color palette) | ||
66 | + | ||
67 | + | ||
68 | +## License | ||
69 | + | ||
70 | +The MIT License | ||
71 | + | ||
72 | +Copyright (c) 2014- Nick Baugh niftylettuce@gmail.com (http://niftylettuce.com/) | ||
73 | + | ||
74 | +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
75 | + | ||
76 | +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
77 | + | ||
78 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
app/controllers/home.js
0 → 100644
app/controllers/index.js
0 → 100644
app/models/common.js
0 → 100644
1 | + | ||
2 | +// # common | ||
3 | + | ||
4 | +module.exports = common | ||
5 | + | ||
6 | +function common(Schema) { | ||
7 | + | ||
8 | + Schema.virtual('id').get(function() { | ||
9 | + return this._id.valueOf() | ||
10 | + }) | ||
11 | + | ||
12 | + Schema.add({ | ||
13 | + updated: { | ||
14 | + default: Date.now, | ||
15 | + type: Date | ||
16 | + } | ||
17 | + }) | ||
18 | + | ||
19 | + Schema.virtual('created').get(function() { | ||
20 | + return this._id.getTimestamp() | ||
21 | + }) | ||
22 | + | ||
23 | + Schema.pre('save', function(next) { | ||
24 | + this.updated = Date.now() | ||
25 | + next() | ||
26 | + }) | ||
27 | + | ||
28 | +} |
app/models/index.js
0 → 100644
app/models/user.js
0 → 100644
1 | + | ||
2 | +// # user | ||
3 | + | ||
4 | +var mongoose = require('mongoose') | ||
5 | +var common = require('./common') | ||
6 | + | ||
7 | +var Schema = mongoose.Schema | ||
8 | +var mongooseTypes = require('mongoose-types') | ||
9 | +mongooseTypes.loadTypes(mongoose) | ||
10 | + | ||
11 | +var Email = mongoose.SchemaTypes.Email | ||
12 | + | ||
13 | +var User = module.exports = new Schema({ | ||
14 | + email: { | ||
15 | + type: Email, | ||
16 | + required: true, | ||
17 | + unique: true | ||
18 | + } | ||
19 | +}) | ||
20 | + | ||
21 | +User.plugin(common) |
app/views/home.jade
0 → 100644
assets/.gitignore
0 → 100644
1 | +dist |
assets/public/favicon.ico
0 → 100644
不能预览此文件类型
assets/public/favicon.png
0 → 100644
686 Bytes
assets/public/img/igloo.png
0 → 100644
11.7 KB
cluster.js
0 → 100644
config/app.js
0 → 100644
1 | + | ||
2 | +// # app | ||
3 | + | ||
4 | +var express = require('express') | ||
5 | +var flash = require('connect-flash') | ||
6 | +var dynamicHelpers = require('./dynamic-helpers') | ||
7 | +var development = require('./development') | ||
8 | +var production = require('./production') | ||
9 | +var auth = require('./auth') | ||
10 | +var routes = require('./routes') | ||
11 | + | ||
12 | +module.exports = function(lib, callback) { | ||
13 | + | ||
14 | + var app = express() | ||
15 | + | ||
16 | + // set the environment | ||
17 | + app.set('env', lib.config.env) | ||
18 | + | ||
19 | + // disable x-powered-by | ||
20 | + app.disable('x-powered-by') | ||
21 | + | ||
22 | + // trust proxy | ||
23 | + app.enable('trust proxy') | ||
24 | + | ||
25 | + // set the default views directory | ||
26 | + app.set('views', lib.config.viewsDir) | ||
27 | + | ||
28 | + // make jade the default view engine | ||
29 | + app.set('view engine', 'jade') | ||
30 | + | ||
31 | + // make jade pretty | ||
32 | + app.locals.pretty = true | ||
33 | + | ||
34 | + // ignore GET /favicon.ico | ||
35 | + app.use(express.favicon(lib.config.favicon)) | ||
36 | + | ||
37 | + // development only config | ||
38 | + app.configure('development', development(lib, app)) | ||
39 | + | ||
40 | + // production only config | ||
41 | + app.configure('production', production(lib, app)) | ||
42 | + | ||
43 | + // pass a secret to cookieParser() for signed cookies | ||
44 | + app.use(express.cookieParser(lib.config.cookieParser)) | ||
45 | + | ||
46 | + // parse request bodies | ||
47 | + app.use(express.json()) | ||
48 | + app.use(express.urlencoded()) | ||
49 | + | ||
50 | + // support _method (PUT in forms etc) | ||
51 | + app.use(express.methodOverride()) | ||
52 | + | ||
53 | + // add req.session cookie support | ||
54 | + app.use(express.session(lib.config.session)) | ||
55 | + | ||
56 | + // add flash message support | ||
57 | + app.use(flash()) | ||
58 | + | ||
59 | + // add dynamic helpers for views | ||
60 | + app.use(dynamicHelpers) | ||
61 | + | ||
62 | + // add support for authentication | ||
63 | + app.configure(auth(lib, app)) | ||
64 | + | ||
65 | + // load the routes | ||
66 | + app.configure(routes(lib, app)) | ||
67 | + | ||
68 | + // make the middleware order matter | ||
69 | + app.use(app.router) | ||
70 | + | ||
71 | + // static server | ||
72 | + app.use(express.static(lib.config.publicDir, lib.config.staticServer)) | ||
73 | + | ||
74 | + // error handling | ||
75 | + app.use(express.errorHandler()) | ||
76 | + | ||
77 | + callback(null, app) | ||
78 | + | ||
79 | +} |
config/auth.js
0 → 100644
1 | + | ||
2 | +// # auth | ||
3 | + | ||
4 | +var passport = require('passport') | ||
5 | + | ||
6 | +var lib, app | ||
7 | + | ||
8 | +module.exports = function(_lib, _app) { | ||
9 | + lib = _lib | ||
10 | + app = _app | ||
11 | + return auth | ||
12 | +} | ||
13 | + | ||
14 | +function auth() { | ||
15 | + | ||
16 | + app.use(passport.initialize()) | ||
17 | + app.use(passport.session()) | ||
18 | + | ||
19 | + passport.serializeUser(serializeUser) | ||
20 | + passport.deserializeUser(deserializeUser) | ||
21 | + | ||
22 | + // TODO: add your passport auth here | ||
23 | + | ||
24 | +} | ||
25 | + | ||
26 | +function serializeUser(user, done) { | ||
27 | + done(null, user.id) | ||
28 | +} | ||
29 | + | ||
30 | +function deserializeUser(id, done) { | ||
31 | + lib.db.model('User').findById(id, function(err, user) { | ||
32 | + done(err, user) | ||
33 | + }) | ||
34 | +} |
config/development.js
0 → 100644
1 | + | ||
2 | +// # development | ||
3 | + | ||
4 | +var winstonRequestLogger = require('winston-request-logger') | ||
5 | +var lessMiddleware = require('less-middleware') | ||
6 | + | ||
7 | +var lib, app | ||
8 | + | ||
9 | +module.exports = function(_lib, _app) { | ||
10 | + lib = _lib | ||
11 | + app = _app | ||
12 | + return development | ||
13 | +} | ||
14 | + | ||
15 | +function development() { | ||
16 | + | ||
17 | + // winston logger | ||
18 | + app.use(winstonRequestLogger.create(lib.logger)) | ||
19 | + | ||
20 | + // less middleware | ||
21 | + app.use(lessMiddleware(lib.config.lessMiddleware)) | ||
22 | + | ||
23 | +} |
config/dynamic-helpers.js
0 → 100644
config/index.js
0 → 100644
1 | + | ||
2 | +// # config | ||
3 | + | ||
4 | +var _ = require('underscore') | ||
5 | +var path = require('path') | ||
6 | + | ||
7 | +var maxAge = 24 * 60 * 60 * 1000 | ||
8 | + | ||
9 | +var config = module.exports = {} | ||
10 | + | ||
11 | +var env = 'development' | ||
12 | + | ||
13 | +var rootDir = path.join(__dirname, '..') | ||
14 | + | ||
15 | +var environments = { | ||
16 | + development: { | ||
17 | + port: 3000, | ||
18 | + host: 'localhost', | ||
19 | + db: { | ||
20 | + host: 'localhost', | ||
21 | + dbname: 'TODO', | ||
22 | + port: '27017', | ||
23 | + opts: {} | ||
24 | + }, | ||
25 | + redis: { | ||
26 | + host: 'localhost', | ||
27 | + port: 6379, | ||
28 | + prefix: 'TODO', | ||
29 | + maxAge: maxAge | ||
30 | + }, | ||
31 | + cookieParser: 'TODO', | ||
32 | + session: { | ||
33 | + secret: 'TODO', | ||
34 | + key: 'TODO', | ||
35 | + cookie: { | ||
36 | + maxAge: maxAge | ||
37 | + } | ||
38 | + }, | ||
39 | + publicDir: path.join(rootDir, 'assets', 'public'), | ||
40 | + lessMiddleware: { | ||
41 | + src: path.join(rootDir, 'assets', 'public'), | ||
42 | + force: true | ||
43 | + } | ||
44 | + }, | ||
45 | + production: { | ||
46 | + port: 80, | ||
47 | + host: '', | ||
48 | + db: {}, | ||
49 | + redis: {}, | ||
50 | + cookieParser: '', | ||
51 | + session: {}, | ||
52 | + publicDir: path.join(rootDir, 'assets', 'dist') | ||
53 | + } | ||
54 | +} | ||
55 | + | ||
56 | +if (_.isString(process.env.NODE_ENV) && _.contains(_.keys(environments), env)) | ||
57 | + env = process.env.NODE_ENV | ||
58 | + | ||
59 | +_.defaults(config, { | ||
60 | + staticServer: { | ||
61 | + maxAge: maxAge, | ||
62 | + }, | ||
63 | + ssl: false, | ||
64 | + env: env, | ||
65 | + rootDir: rootDir, | ||
66 | + viewsDir: path.join(rootDir, 'app', 'views'), | ||
67 | +}) | ||
68 | + | ||
69 | +_.extend(config, environments[config.env]) | ||
70 | + | ||
71 | +config.protocol = (config.ssl) ? 'https' : 'http' | ||
72 | + | ||
73 | +config.favicon = path.join(config.publicDir, 'favicon.ico') | ||
74 | + | ||
75 | +config.winstonMongoDB = _.extend(config.db, { | ||
76 | + // don't perform second req to verify | ||
77 | + safe: false, | ||
78 | + port: parseInt(config.db.port, 10) | ||
79 | +}) |
config/production.js
0 → 100644
1 | + | ||
2 | +// # production | ||
3 | + | ||
4 | +var winston = require('winston') | ||
5 | +var winstonMongoDB = require('winston-mongodb') | ||
6 | +var express = require('express') | ||
7 | + | ||
8 | +var lib, app | ||
9 | + | ||
10 | +module.exports = function(_lib, _app) { | ||
11 | + lib = _lib | ||
12 | + app = _app | ||
13 | + return production | ||
14 | +} | ||
15 | + | ||
16 | +function production() { | ||
17 | + | ||
18 | + // enable view caching | ||
19 | + app.enable('view cache') | ||
20 | + | ||
21 | + // compress response data with gzip/deflate | ||
22 | + // this overwrites res.write and res.end functions | ||
23 | + app.use(express.compress()) | ||
24 | + | ||
25 | + // mongo transport for winston logging | ||
26 | + lib.logger.remove(winston.transports.Console) | ||
27 | + winstonMongoDB.add(winstonMongoDB.MongoDB, lib.config.winstonMongoDB) | ||
28 | + | ||
29 | +} |
config/routes.js
0 → 100644
igloo.js
0 → 100644
1 | + | ||
2 | +// # Igloo | ||
3 | + | ||
4 | +var async = require('async') | ||
5 | +var config = require('./config') | ||
6 | +var schemas = require('./schemas') | ||
7 | +var lib = require('./lib')(config) | ||
8 | +var app = require('./config/app') | ||
9 | + | ||
10 | +module.exports = igloo | ||
11 | + | ||
12 | +function igloo(callback) { | ||
13 | + | ||
14 | + async.parallel({ | ||
15 | + db: lib.mongo, | ||
16 | + sessions: lib.redis | ||
17 | + }, loadConnections) | ||
18 | + | ||
19 | + function loadConnections(err, connections) { | ||
20 | + if (err) return callback(err) | ||
21 | + lib.db = connections.db | ||
22 | + lib.config.session.store = lib.sessions = connections.sessions | ||
23 | + schemas(lib, loadSchemas) | ||
24 | + } | ||
25 | + | ||
26 | + function loadSchemas(err, lib) { | ||
27 | + if (err) return callback(err) | ||
28 | + app(lib, callback) | ||
29 | + } | ||
30 | + | ||
31 | +} | ||
32 | + | ||
33 | +if (!module.parent) | ||
34 | + igloo(function(err, app) { | ||
35 | + if (err) return lib.logger.error(err) | ||
36 | + app.listen(config.port, function() { | ||
37 | + lib.logger.info('Igloo started at %s://%s:%d', config.protocol, config.host, config.port) | ||
38 | + }) | ||
39 | + }) |
lib/index.js
0 → 100644
lib/logger.js
0 → 100644
lib/mongo.js
0 → 100644
1 | + | ||
2 | +// # mongo | ||
3 | + | ||
4 | +var mongoose = require('mongoose') | ||
5 | + | ||
6 | +var config | ||
7 | + | ||
8 | +module.exports = function(_config) { | ||
9 | + config = _config | ||
10 | + return mongo | ||
11 | +} | ||
12 | + | ||
13 | +function mongo(callback) { | ||
14 | + var connection = mongoose.createConnection( | ||
15 | + config.db.host, | ||
16 | + config.db.dbname, | ||
17 | + config.db.port, | ||
18 | + config.db.opts | ||
19 | + ) | ||
20 | + connection.on('error', callback) | ||
21 | + connection.on('open', function() { | ||
22 | + callback(null, connection) | ||
23 | + }) | ||
24 | +} |
lib/redis.js
0 → 100644
1 | + | ||
2 | +// # redis | ||
3 | + | ||
4 | +var express = require('express') | ||
5 | +var RedisStore = require('connect-redis')(express) | ||
6 | + | ||
7 | +var config | ||
8 | + | ||
9 | +module.exports = function(_config) { | ||
10 | + config = _config | ||
11 | + return redis | ||
12 | +} | ||
13 | + | ||
14 | +function redis(callback) { | ||
15 | + var connection = new RedisStore(config.redis) | ||
16 | + connection.on('error', callback) | ||
17 | + connection.on('connect', function() { | ||
18 | + callback(null, connection) | ||
19 | + }) | ||
20 | +} |
package.json
0 → 100644
1 | +{ | ||
2 | + "name": "igloo", | ||
3 | + "version": "0.0.1", | ||
4 | + "description": "Igloo is a minimal app boilerplate built with Express.", | ||
5 | + "main": "igloo.js", | ||
6 | + "repository": { | ||
7 | + "type": "git", | ||
8 | + "url": "git://github.com/niftylettuce/igloo.git" | ||
9 | + }, | ||
10 | + "author": "Nick Baugh <niftylettuce@gmail.com>", | ||
11 | + "bugs": { | ||
12 | + "url": "https://github.com/niftylettuce/igloo/issues" | ||
13 | + }, | ||
14 | + "bin": { | ||
15 | + "igloo": "./bin/igloo" | ||
16 | + }, | ||
17 | + "license": "MIT", | ||
18 | + "homepage": "https://github.com/niftylettuce/igloo", | ||
19 | + "dependencies": { | ||
20 | + "passport": "~0.2.0", | ||
21 | + "express-rate": "0.0.1", | ||
22 | + "jade": "~1.1.5", | ||
23 | + "express": "~3.4.8", | ||
24 | + "mongoose": "~3.8.7", | ||
25 | + "connect-redis": "~1.4.6", | ||
26 | + "underscore": "~1.6.0", | ||
27 | + "async": "~0.2.10", | ||
28 | + "winston": "~0.7.2", | ||
29 | + "mongoose-types": "~1.0.3", | ||
30 | + "less-middleware": "~0.1.15", | ||
31 | + "connect-flash": "~0.1.1", | ||
32 | + "winston-mongodb": "~0.4.3", | ||
33 | + "winston-request-logger": "~1.0.4" | ||
34 | + } | ||
35 | +} |
schemas/index.js
0 → 100644
1 | + | ||
2 | +// # schemas | ||
3 | + | ||
4 | +var _ = require('underscore') | ||
5 | + | ||
6 | +var models = require('../app/models') | ||
7 | + | ||
8 | +module.exports = schemas | ||
9 | + | ||
10 | +function schemas(lib, callback) { | ||
11 | + | ||
12 | + _.each(models, function(schema, name) { | ||
13 | + lib.db.model(name, schema) | ||
14 | + }) | ||
15 | + | ||
16 | + callback(null, lib) | ||
17 | + | ||
18 | +} |
请
注册
或
登录
后发表评论