Skip to content

Commit c2d77df

Browse files
authored
Merge pull request #1 from meanstack-io/develop
Version 0.2.0
2 parents d670dd4 + 1079f66 commit c2d77df

File tree

119 files changed

+1625
-835
lines changed

Some content is hidden

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

119 files changed

+1625
-835
lines changed

.bowerrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "resources/assets/bower"
3+
}

.gitignore

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
.idea/*
2-
node_modules/*
3-
public/dist/*
4-
bower_components/*
5-
/config.js
6-
/config/*
1+
.idea
2+
node_modules
3+
!node_modules/app
4+
!node_modules/config
5+
!node_modules/modules
6+
!node_modules/resources
7+
public
8+
resources/assets/bower
9+
config/config-*.js

License

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MEANStack bringing together the best of MEAN MongoDB, Express, AngularJS and Node.js
1+
MEANStack.io bringing together the best of MEAN MongoDB, Express, AngularJS and Node.js
22
The purpose of the application is to facilitate the development offering the best of MEAN with a stack of packages, frameworks, libraries and strategies.
33

44
The MIT License (MIT)

README.md

Lines changed: 107 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MEANStack
1+
# MEANStack.io
22
*bringing together the best of MEAN MongoDB, Express, AngularJS and Node.js*
33

44
Is a solution full-stack JavaScript, based on MongoDB, Express, AngularJS, Node.js and another stack of packages.
@@ -17,12 +17,114 @@ Is a solution full-stack JavaScript, based on MongoDB, Express, AngularJS, Node.
1717

1818
Are some of the packages that we use to make this dream come true.
1919

20-
## Getting Started
21-
Getting started ? go to the official page [meanstack.developscript.com](http://meanstack.developscript.com/getting-started)
20+
## Prerequisites
21+
Install Node.js e MongoDB.
22+
23+
### Install Node.js
24+
Installing Node.js via package manager access <a href="https://nodejs.org/en/download/package-manager/">https://nodejs.org/en/download/package-manager/</a>
25+
26+
#### Notes
27+
if you use Debian and Ubuntu based Linux distributions be sure to install **build-essential**.
28+
```bash
29+
$ sudo apt-get install -y build-essential
30+
```
31+
32+
if you use Enterprise Linux and Fedora be sure to install **gcc-c++ make**.
33+
```bash
34+
$ yum install gcc-c++ make
35+
```
36+
37+
### Install MongoDB
38+
Installing MongoDB access <a href="https://docs.mongodb.org/manual/installation/">https://docs.mongodb.org/manual/installation/</a>
39+
40+
#### Note
41+
If you've never worked with a MongoDB read in your documentation before you install it, official documentation access, <a href="https://docs.mongodb.org/manual/">https://docs.mongodb.org/manual/</a>
42+
43+
## Installation
44+
45+
Before you begin installing MEANStack we will update the NPM and soon after installing Gulp, Bower and nodemon in the global scope.
46+
47+
### Updating NPM
48+
```bash
49+
$ npm update -g npm
50+
```
51+
52+
### Install Gulp
53+
```bash
54+
$ npm install -g gulp
55+
```
56+
57+
### Install Bower
58+
```bash
59+
$ npm install -g bower
60+
```
61+
62+
### Install Nodemon
63+
Nodemon is a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development. Install it using npm.
64+
```bash
65+
$ npm install -g nodemon
66+
```
67+
68+
#### Note
69+
If you already have the Gulp and Bower recommend updates them.
70+
```bash
71+
$ npm update -g gulp bower
72+
```
73+
74+
### The first step
75+
Clone the repository GitHub.
76+
```bash
77+
$ git clone git@github.com:developscript/meanstack.io.git
78+
```
79+
80+
### The second step
81+
Install the back-end dependencies.
82+
```bash
83+
$ npm install
84+
```
85+
86+
### The third step
87+
Install the front-end dependencies.
88+
```bash
89+
$ bower install
90+
```
91+
92+
### The fourth step
93+
Configure the application. For this we have a sample file "config/config.example.js" copy and rename it to "config/config-development.js".
94+
```bash
95+
$ cp config/config.example.js config/config-development.js
96+
```
97+
98+
#### Configuration file.
99+
The file "config/config-development.js" represents the configuration of your environment. What ? within package.json we have:
100+
```js
101+
"start": "NODE_ENV=development nodemon ./bin/www"
102+
```
103+
The "NODE_ENV" property sets which environment setting will be used. Example:
104+
```js
105+
"start": "NODE_ENV=production nodemon ./bin/www" // Its configuration file is "config/config-production.js".
106+
```
107+
108+
### The fifth step
109+
Run Gulp.
110+
```bash
111+
$ gulp
112+
```
113+
114+
### The sixth step
115+
Start the application.
116+
```bash
117+
$ npm start
118+
```
119+
120+
If you want to use the Gulp with Browsersync
121+
```bash
122+
$ gulp watch
123+
```
22124

23125
## Documentation
24-
Documentation can be found on the [meanstack.developscript.com](http://meanstack.developscript.com/documentation)
126+
Documentation can be found on the [meanstack.io](http://meanstack.io/documentation)
25127

26128
## Copyright & License
27129

28-
Copyright © 2016 Developscript - Licensed under [MIT](https://github.com/developscript/meanstack/blob/master/License).
130+
Copyright © 2016 Developscript - Licensed under [MIT](https://github.com/developscript/meanstack.io/blob/master/License).

app.js

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,32 @@
33
var express = require('express'),
44
app = express(),
55
path = require('path'),
6+
compression = require('compression'),
67
favicon = require('serve-favicon'),
78
logger = require('morgan'),
89
cookieParser = require('cookie-parser'),
910
bodyParser = require('body-parser'),
1011
session = require('express-session'),
1112
store = new session.MemoryStore(),
12-
passport = require('passport'),
13-
response = require('./modules/response'),
14-
passportStrategies = require('./passport'),
15-
policies = require('./routes/policies'),
16-
routes = require('./routes'),
17-
settings = require('./config'),
18-
hbs = require('express-handlebars').create(
13+
middleware = require('app/http/middleware'),
14+
routes = require('app/http/routes'),
15+
settings = require('config'),
16+
hbs = require('express-hbs'),
17+
hbsEngine = hbs.express4(
1918
{
2019
extname: ".hbs",
21-
partialsDir: path.join(__dirname, 'views/partials/')
20+
layoutsDir: path.join(__dirname, 'resources/views/layouts/'),
21+
partialsDir: path.join(__dirname, 'resources/views/partials/')
2222
}
23-
);
23+
),
24+
hbsHelpers = require('app/helpers');
2425

25-
app.engine('hbs', hbs.engine);
26+
app.engine('hbs', hbsEngine);
2627
app.set('view engine', 'hbs');
27-
app.set('views', path.join(__dirname, 'views'));
28-
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
28+
hbsHelpers();
29+
app.use(compression());
30+
app.set('views', path.join(__dirname, 'resources/views'));
31+
app.use(favicon(path.join(__dirname, 'public', 'favicon.png')));
2932
app.use(express.static(path.join(__dirname, 'public')));
3033
app.use(logger('dev'));
3134
app.use(bodyParser.json());
@@ -38,36 +41,26 @@ app.use(session(
3841
saveUninitialized: false,
3942
store: store,
4043
cookie: {
41-
httpOnly: true, maxAge: 2419200000
44+
httpOnly: true,
45+
maxAge: (typeof settings.cookie.maxAge !== 'undefined')? settings.cookie.maxAge : 2419200000
4246
}
4347
}
4448
)
4549
);
4650

4751
/**
48-
* Module Response
52+
* Init Middleware.
4953
*/
50-
app.use(response());
54+
middleware(app);
5155

52-
/**
53-
* Init Passaport
54-
*/
55-
app.use(passport.initialize());
56-
app.use(passport.session());
57-
passportStrategies(passport);
58-
59-
/**
60-
* Module Auth
61-
*/
62-
policies(app);
6356

6457
/**
65-
* Initialize Routes
58+
* Initialize Routes.
6659
*/
6760
routes(app);
6861

6962
/**
70-
* error handler
63+
* Error handler.
7164
*/
7265
app.use(function (err, req, res, next) {
7366
res.status(err.status || 500);

app/helpers/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
/**
4+
* Helpers for Handlebars.
5+
*
6+
* Example:
7+
* {{ foo }} or {{ ucfirst variable }}
8+
*
9+
* More documentation:
10+
* http://handlebarsjs.com/expressions.html#helpers,
11+
* https://github.com/barc/express-hbs
12+
*/
13+
var hbs = require('express-hbs'),
14+
ucfirst = require('./ucfirst');
15+
16+
module.exports = function () {
17+
18+
// Make a string's first character uppercase.
19+
ucfirst();
20+
21+
};

app/helpers/ucfirst.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
3+
var hbs = require('express-hbs');
4+
5+
module.exports = function () {
6+
/**
7+
* Make a string's first character uppercase.
8+
*
9+
* @param str
10+
* @returns {string}
11+
*/
12+
hbs.registerHelper('ucfirst', function (str) {
13+
var f = str.charAt(0)
14+
.toUpperCase();
15+
return f + str.substr(1);
16+
});
17+
};

0 commit comments

Comments
 (0)