This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
1,075 additions
and
962 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# Howto with your editor: | ||
# Sublime: https://github.com/sindresorhus/editorconfig-sublime | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[**] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
# Standard at: https://github.com/felixge/node-style-guide | ||
[**.js, **.json] | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 2 | ||
max_line_length = 80 | ||
quote_type = single | ||
curly_bracket_next_line = false | ||
spaces_around_operators = true | ||
space_after_control_statements = true | ||
space_after_anonymous_functions = false | ||
spaces_in_brackets = false | ||
|
||
# https://github.com/jedmao/codepainter | ||
[node_modules/**.js] | ||
codepaint = false | ||
|
||
# No Standard. Please document a standard if different from .js | ||
[**.yml, **.html, **.css] | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# No standard. Please document a standard if different from .js | ||
[**.md] | ||
indent_style = space | ||
|
||
# Standard at: | ||
[**.py] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# Standard at: | ||
[Makefile] | ||
indent_style = tab | ||
indent_size = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
npm-debug.log | ||
node_modules/ | ||
public/lib | ||
public/dist | ||
app/tests/coverage/ | ||
.bower-*/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM dockerfile/nodejs | ||
|
||
MAINTAINER Matthias Luebken, matthias@catalyst-zero.com | ||
|
||
WORKDIR /home/mean | ||
|
||
# Install Mean.JS Prerequisites | ||
RUN npm install -g grunt-cli | ||
RUN npm install -g bower | ||
|
||
# Install Mean.JS packages | ||
ADD package.json /home/mean/package.json | ||
RUN npm install | ||
|
||
# Manually trigger bower. Why doesnt this work via npm install? | ||
ADD .bowerrc /home/mean/.bowerrc | ||
ADD bower.json /home/mean/bower.json | ||
RUN bower install --config.interactive=false --allow-root | ||
|
||
# Make everything available for start | ||
ADD . /home/mean | ||
|
||
# currently only works for development | ||
ENV NODE_ENV development | ||
|
||
# Port 3000 for server | ||
# Port 35729 for livereload | ||
EXPOSE 3000 35729 | ||
CMD ["grunt"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Get unique error field name | ||
*/ | ||
var getUniqueErrorMessage = function(err) { | ||
var output; | ||
|
||
try { | ||
var fieldName = err.err.substring(err.err.lastIndexOf('.$') + 2, err.err.lastIndexOf('_1')); | ||
output = fieldName.charAt(0).toUpperCase() + fieldName.slice(1) + ' already exist'; | ||
|
||
} catch(ex) { | ||
output = 'Unique field already exist'; | ||
} | ||
|
||
return output; | ||
}; | ||
|
||
/** | ||
* Get the error message from error object | ||
*/ | ||
exports.getErrorMessage = function(err) { | ||
var message = ''; | ||
|
||
if (err.code) { | ||
switch (err.code) { | ||
case 11000: | ||
case 11001: | ||
message = getUniqueErrorMessage(err); | ||
break; | ||
default: | ||
message = 'Something went wrong'; | ||
} | ||
} else { | ||
for (var errName in err.errors) { | ||
if (err.errors[errName].message) message = err.errors[errName].message; | ||
} | ||
} | ||
|
||
return message; | ||
}; |
Oops, something went wrong.