Skip to content

Commit 0b7db56

Browse files
committed
initial commit
0 parents  commit 0b7db56

File tree

113 files changed

+4849
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+4849
-0
lines changed

Diff for: .bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "public/lib"
3+
}

Diff for: .csslintrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"adjoining-classes": false,
3+
"box-model": false,
4+
"box-sizing": false,
5+
"floats": false,
6+
"font-sizes": false,
7+
"important": false,
8+
"known-properties": false,
9+
"overqualified-elements": false,
10+
"qualified-headings": false,
11+
"regex-selectors": false,
12+
"unique-headings": false,
13+
"universal-selector": false,
14+
"unqualified-attributes": false
15+
}

Diff for: .editorconfig

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# Howto with your editor:
4+
# Sublime: https://github.com/sindresorhus/editorconfig-sublime
5+
6+
# top-most EditorConfig file
7+
root = true
8+
9+
# Unix-style newlines with a newline ending every file
10+
[**]
11+
end_of_line = lf
12+
insert_final_newline = true
13+
14+
# Standard at: https://github.com/felixge/node-style-guide
15+
[**.js, **.json]
16+
trim_trailing_whitespace = true
17+
indent_style = space
18+
indent_size = 2
19+
max_line_length = 80
20+
quote_type = single
21+
curly_bracket_next_line = false
22+
spaces_around_operators = true
23+
space_after_control_statements = true
24+
space_after_anonymous_functions = false
25+
spaces_in_brackets = false
26+
27+
# https://github.com/jedmao/codepainter
28+
[node_modules/**.js]
29+
codepaint = false
30+
31+
# No Standard. Please document a standard if different from .js
32+
[**.yml, **.html, **.css]
33+
trim_trailing_whitespace = true
34+
indent_style = space
35+
indent_size = 2
36+
37+
# No standard. Please document a standard if different from .js
38+
[**.md]
39+
indent_style = space
40+
41+
# Standard at:
42+
[**.py]
43+
indent_style = space
44+
indent_size = 4
45+
46+
# Standard at:
47+
[Makefile]
48+
indent_style = tab
49+
indent_size = 8

Diff for: .gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.DS_Store
2+
.nodemonignore
3+
.sass-cache/
4+
npm-debug.log
5+
node_modules/
6+
public/lib
7+
app/tests/coverage/
8+
.bower-*/
9+
.idea/
10+
migrations/.migrate

Diff for: .jshintrc

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
3+
"browser": true, // Standard browser globals e.g. `window`, `document`.
4+
"esnext": true, // Allow ES.next specific features such as `const` and `let`.
5+
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
6+
"camelcase": false, // Permit only camelcase for `var` and `object indexes`.
7+
"curly": false, // Require {} for every new block or scope.
8+
"eqeqeq": true, // Require triple equals i.e. `===`.
9+
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
10+
"latedef": true, // Prohibit variable use before definition.
11+
"newcap": true, // Require capitalization of all constructor functions e.g. `new F()`.
12+
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
13+
"quotmark": "single", // Define quotes to string values.
14+
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
15+
"undef": true, // Require all non-global variables be declared before they are used.
16+
"unused": false, // Warn unused variables.
17+
"strict": true, // Require `use strict` pragma in every file.
18+
"trailing": true, // Prohibit trailing whitespaces.
19+
"smarttabs": false, // Suppresses warnings about mixed tabs and spaces
20+
"globals": { // Globals variables.
21+
"jasmine": true,
22+
"angular": true,
23+
"ApplicationConfiguration": true
24+
},
25+
"predef": [ // Extra globals.
26+
"define",
27+
"require",
28+
"exports",
29+
"module",
30+
"describe",
31+
"before",
32+
"beforeEach",
33+
"after",
34+
"afterEach",
35+
"it",
36+
"inject",
37+
"expect"
38+
],
39+
"indent": 2, // Specify indentation spacing
40+
"devel": true, // Allow development statements e.g. `console.log();`.
41+
"noempty": true // Prohibit use of empty blocks.
42+
}

Diff for: .slugignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/app/tests

Diff for: .travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: node_js
2+
node_js:
3+
- "0.10"
4+
env:
5+
- NODE_ENV=travis
6+
services:
7+
- mongodb

Diff for: Dockerfile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM dockerfile/nodejs
2+
3+
MAINTAINER Matthias Luebken, [email protected]
4+
5+
WORKDIR /home/mean
6+
7+
# Install Mean.JS Prerequisites
8+
RUN npm install -g grunt-cli
9+
RUN npm install -g bower
10+
11+
# Install Mean.JS packages
12+
ADD package.json /home/mean/package.json
13+
RUN npm install
14+
15+
# Manually trigger bower. Why doesnt this work via npm install?
16+
ADD .bowerrc /home/mean/.bowerrc
17+
ADD bower.json /home/mean/bower.json
18+
RUN bower install --config.interactive=false --allow-root
19+
20+
# Make everything available for start
21+
ADD . /home/mean
22+
23+
# currently only works for development
24+
ENV NODE_ENV development
25+
26+
# Port 3000 for server
27+
# Port 35729 for livereload
28+
EXPOSE 3000 35729
29+
CMD ["grunt"]

Diff for: LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## License
2+
(The MIT License)
3+
4+
Permission is hereby granted, free of charge, to any person obtaining
5+
a copy of this software and associated documentation files (the
6+
'Software'), to deal in the Software without restriction, including
7+
without limitation the rights to use, copy, modify, merge, publish,
8+
distribute, sublicense, and/or sell copies of the Software, and to
9+
permit persons to whom the Software is furnished to do so, subject to
10+
the following conditions:
11+
12+
The above copyright notice and this permission notice shall be
13+
included in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Diff for: Procfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: ./node_modules/.bin/forever -m 5 server.js

Diff for: README.md

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
[![MEAN.JS Logo](http://meanjs.org/img/logo-small.png)](http://meanjs.org/)
2+
3+
[![Build Status](https://travis-ci.org/meanjs/mean.svg?branch=master)](https://travis-ci.org/meanjs/mean)
4+
[![Dependencies Status](https://david-dm.org/meanjs/mean.svg)](https://david-dm.org/meanjs/mean)
5+
6+
MEAN.JS is a full-stack JavaScript open-source solution, which provides a solid starting point for [MongoDB](http://www.mongodb.org/), [Node.js](http://www.nodejs.org/), [Express](http://expressjs.com/), and [AngularJS](http://angularjs.org/) based applications. The idea is to solve the common issues with connecting those frameworks, build a robust framework to support daily development needs, and help developers use better practices while working with popular JavaScript components.
7+
8+
## Before You Begin
9+
Before you begin we recommend you read about the basic building blocks that assemble a MEAN.JS application:
10+
* MongoDB - Go through [MongoDB Official Website](http://mongodb.org/) and proceed to their [Official Manual](http://docs.mongodb.org/manual/), which should help you understand NoSQL and MongoDB better.
11+
* Express - The best way to understand express is through its [Official Website](http://expressjs.com/), particularly [The Express Guide](http://expressjs.com/guide.html); you can also go through this [StackOverflow Thread](http://stackoverflow.com/questions/8144214/learning-express-for-node-js) for more resources.
12+
* AngularJS - Angular's [Official Website](http://angularjs.org/) is a great starting point. You can also use [Thinkster Popular Guide](http://www.thinkster.io/), and the [Egghead Videos](https://egghead.io/).
13+
* Node.js - Start by going through [Node.js Official Website](http://nodejs.org/) and this [StackOverflow Thread](http://stackoverflow.com/questions/2353818/how-do-i-get-started-with-node-js), which should get you going with the Node.js platform in no time.
14+
15+
16+
## Prerequisites
17+
Make sure you have installed all these prerequisites on your development machine.
18+
* Node.js - [Download & Install Node.js](http://www.nodejs.org/download/) and the npm package manager, if you encounter any problems, you can also use this [Github Gist](https://gist.github.com/isaacs/579814) to install Node.js.
19+
* MongoDB - [Download & Install MongoDB](http://www.mongodb.org/downloads), and make sure it's running on the default port (27017).
20+
* Bower - You're going to use the [Bower Package Manager](http://bower.io/) to manage your front-end packages, in order to install it make sure you've installed Node.js and npm, then install bower globally using npm:
21+
22+
```
23+
$ npm install -g bower
24+
```
25+
26+
* Grunt - You're going to use the [Grunt Task Runner](http://gruntjs.com/) to automate your development process, in order to install it make sure you've installed Node.js and npm, then install grunt globally using npm:
27+
28+
```
29+
$ sudo npm install -g grunt-cli
30+
```
31+
32+
## Downloading MEAN.JS
33+
There are several ways you can get the MEAN.JS boilerplate:
34+
35+
### Yo Generator
36+
The recommended way would be to use the [Official Yo Generator](http://meanjs.org/generator.html) which will generate the latest stable copy of the MEAN.JS boilerplate and supplies multiple sub-generators to ease your daily development cycles.
37+
38+
### Cloning The GitHub Repository
39+
You can also use Git to directly clone the MEAN.JS repository:
40+
```
41+
$ git clone https://github.com/meanjs/mean.git meanjs
42+
```
43+
This will clone the latest version of the MEAN.JS repository to a **meanjs** folder.
44+
45+
### Downloading The Repository Zip File
46+
Another way to use the MEAN.JS boilerplate is to download a zip copy from the [master branch on github](https://github.com/meanjs/mean/archive/master.zip). You can also do this using `wget` command:
47+
```
48+
$ wget https://github.com/meanjs/mean/archive/master.zip -O meanjs.zip; unzip meanjs.zip; rm meanjs.zip
49+
```
50+
Don't forget to rename **mean-master** after your project name.
51+
52+
## Quick Install
53+
Once you've downloaded the boilerplate and installed all the prerequisites, you're just a few steps away from starting to develop you MEAN application.
54+
55+
The first thing you should do is install the Node.js dependencies. The boilerplate comes pre-bundled with a package.json file that contains the list of modules you need to start your application, to learn more about the modules installed visit the NPM & Package.json section.
56+
57+
To install Node.js dependencies you're going to use npm again, in the application folder run this in the command-line:
58+
59+
```
60+
$ npm install
61+
```
62+
63+
This command does a few things:
64+
* First it will install the dependencies needed for the application to run.
65+
* If you're running in a development environment, it will then also install development dependencies needed for testing and running your application.
66+
* Finally, when the install process is over, npm will initiate a bower installcommand to install all the front-end modules needed for the application
67+
68+
## Running Your Application
69+
After the install process is over, you'll be able to run your application using Grunt, just run grunt default task:
70+
71+
```
72+
$ grunt
73+
```
74+
75+
Your application should run on the 3000 port so in your browser just go to [http://localhost:3000](http://localhost:3000)
76+
77+
That's it! your application should be running by now, to proceed with your development check the other sections in this documentation.
78+
If you encounter any problem try the Troubleshooting section.
79+
80+
## Development and deployment With Docker
81+
82+
* Install [Docker](http://www.docker.com/)
83+
* Install [Fig](https://github.com/orchardup/fig)
84+
85+
* Local development and testing with fig:
86+
```bash
87+
$ fig up
88+
```
89+
90+
* Local development and testing with just Docker:
91+
```bash
92+
$ docker build -t mean .
93+
$ docker run -p 27017:27017 -d --name db mongo
94+
$ docker run -p 3000:3000 --link db:db_1 mean
95+
$
96+
```
97+
98+
* To enable live reload forward 35729 port and mount /app and /public as volumes:
99+
```bash
100+
$ docker run -p 3000:3000 -p 35729:35729 -v /Users/mdl/workspace/mean-stack/mean/public:/home/mean/public -v /Users/mdl/workspa/mean-stack/mean/app:/home/mean/app --link db:db_1 mean
101+
```
102+
103+
## Getting Started With MEAN.JS
104+
You have your application running but there are a lot of stuff to understand, we recommend you'll go over the [Offical Documentation](http://meanjs.org/docs.html).
105+
In the docs we'll try to explain both general concepts of MEAN components and give you some guidelines to help you improve your development procees. We tried covering as many aspects as possible, and will keep update it by your request, you can also help us develop the documentation better by checking out the *gh-pages* branch of this repository.
106+
107+
## Community
108+
* Use to [Offical Website](http://meanjs.org) to learn about changes and the roadmap.
109+
* Join #meanjs on freenode.
110+
* Discuss it in the new [Google Group](https://groups.google.com/d/forum/meanjs)
111+
* Ping us on [Twitter](http://twitter.com/meanjsorg) and [Facebook](http://facebook.com/meanjs)
112+
113+
## Live Example
114+
Browse the live MEAN.JS example on [http://meanjs.herokuapp.com](http://meanjs.herokuapp.com).
115+
116+
## Credits
117+
Inspired by the great work of [Madhusudhan Srinivasa](https://github.com/madhums/)
118+
The MEAN name was coined by [Valeri Karpov](http://blog.mongodb.org/post/49262866911/the-mean-stack-mongodb-expressjs-angularjs-and)
119+
120+
## License
121+
(The MIT License)
122+
123+
Permission is hereby granted, free of charge, to any person obtaining
124+
a copy of this software and associated documentation files (the
125+
'Software'), to deal in the Software without restriction, including
126+
without limitation the rights to use, copy, modify, merge, publish,
127+
distribute, sublicense, and/or sell copies of the Software, and to
128+
permit persons to whom the Software is furnished to do so, subject to
129+
the following conditions:
130+
131+
The above copyright notice and this permission notice shall be
132+
included in all copies or substantial portions of the Software.
133+
134+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
135+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
136+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
137+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
138+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
139+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
140+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Diff for: app/controllers/articleController.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Created by vedi on 11/15/13.
3+
*/
4+
'use strict';
5+
var
6+
_ = require('lodash'),
7+
Q = require('q'),
8+
Article = require('mongoose').model('Article'),
9+
BaseController = require('./baseController')
10+
;
11+
12+
var ArticleController = BaseController.extend({
13+
ModelClass: Article,
14+
path: '/api/articles',
15+
fields: ['title', 'content', 'user', 'created'],
16+
qFields: ['title'],
17+
defaultOptions: {
18+
queryPipe: function (query, req, res, callback) {
19+
return query.populate('user', 'displayName', callback);
20+
}
21+
},
22+
prepareData: function (req, res, callback) {
23+
callback(null, {user: req.user});
24+
}
25+
});
26+
module.exports = ArticleController;
27+

0 commit comments

Comments
 (0)