Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "resources/assets/bower"
}
15 changes: 9 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.idea/*
node_modules/*
public/dist/*
bower_components/*
/config.js
/config/*
.idea
node_modules
!node_modules/app
!node_modules/config
!node_modules/modules
!node_modules/resources
public
resources/assets/bower
config/config-*.js
2 changes: 1 addition & 1 deletion License
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MEANStack bringing together the best of MEAN MongoDB, Express, AngularJS and Node.js
MEANStack.io bringing together the best of MEAN MongoDB, Express, AngularJS and Node.js
The purpose of the application is to facilitate the development offering the best of MEAN with a stack of packages, frameworks, libraries and strategies.

The MIT License (MIT)
Expand Down
112 changes: 107 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# MEANStack
# MEANStack.io
*bringing together the best of MEAN MongoDB, Express, AngularJS and Node.js*

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

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

## Getting Started
Getting started ? go to the official page [meanstack.developscript.com](http://meanstack.developscript.com/getting-started)
## Prerequisites
Install Node.js e MongoDB.

### Install Node.js
Installing Node.js via package manager access <a href="https://nodejs.org/en/download/package-manager/">https://nodejs.org/en/download/package-manager/</a>

#### Notes
if you use Debian and Ubuntu based Linux distributions be sure to install **build-essential**.
```bash
$ sudo apt-get install -y build-essential
```

if you use Enterprise Linux and Fedora be sure to install **gcc-c++ make**.
```bash
$ yum install gcc-c++ make
```

### Install MongoDB
Installing MongoDB access <a href="https://docs.mongodb.org/manual/installation/">https://docs.mongodb.org/manual/installation/</a>

#### Note
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>

## Installation

Before you begin installing MEANStack we will update the NPM and soon after installing Gulp, Bower and nodemon in the global scope.

### Updating NPM
```bash
$ npm update -g npm
```

### Install Gulp
```bash
$ npm install -g gulp
```

### Install Bower
```bash
$ npm install -g bower
```

### Install Nodemon
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.
```bash
$ npm install -g nodemon
```

#### Note
If you already have the Gulp and Bower recommend updates them.
```bash
$ npm update -g gulp bower
```

### The first step
Clone the repository GitHub.
```bash
$ git clone git@github.com:developscript/meanstack.io.git
```

### The second step
Install the back-end dependencies.
```bash
$ npm install
```

### The third step
Install the front-end dependencies.
```bash
$ bower install
```

### The fourth step
Configure the application. For this we have a sample file "config/config.example.js" copy and rename it to "config/config-development.js".
```bash
$ cp config/config.example.js config/config-development.js
```

#### Configuration file.
The file "config/config-development.js" represents the configuration of your environment. What ? within package.json we have:
```js
"start": "NODE_ENV=development nodemon ./bin/www"
```
The "NODE_ENV" property sets which environment setting will be used. Example:
```js
"start": "NODE_ENV=production nodemon ./bin/www" // Its configuration file is "config/config-production.js".
```

### The fifth step
Run Gulp.
```bash
$ gulp
```

### The sixth step
Start the application.
```bash
$ npm start
```

If you want to use the Gulp with Browsersync
```bash
$ gulp watch
```

## Documentation
Documentation can be found on the [meanstack.developscript.com](http://meanstack.developscript.com/documentation)
Documentation can be found on the [meanstack.io](http://meanstack.io/documentation)

## Copyright & License

Copyright © 2016 Developscript - Licensed under [MIT](https://github.com/developscript/meanstack/blob/master/License).
Copyright © 2016 Developscript - Licensed under [MIT](https://github.com/developscript/meanstack.io/blob/master/License).
49 changes: 21 additions & 28 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,32 @@
var express = require('express'),
app = express(),
path = require('path'),
compression = require('compression'),
favicon = require('serve-favicon'),
logger = require('morgan'),
cookieParser = require('cookie-parser'),
bodyParser = require('body-parser'),
session = require('express-session'),
store = new session.MemoryStore(),
passport = require('passport'),
response = require('./modules/response'),
passportStrategies = require('./passport'),
policies = require('./routes/policies'),
routes = require('./routes'),
settings = require('./config'),
hbs = require('express-handlebars').create(
middleware = require('app/http/middleware'),
routes = require('app/http/routes'),
settings = require('config'),
hbs = require('express-hbs'),
hbsEngine = hbs.express4(
{
extname: ".hbs",
partialsDir: path.join(__dirname, 'views/partials/')
layoutsDir: path.join(__dirname, 'resources/views/layouts/'),
partialsDir: path.join(__dirname, 'resources/views/partials/')
}
);
),
hbsHelpers = require('app/helpers');

app.engine('hbs', hbs.engine);
app.engine('hbs', hbsEngine);
app.set('view engine', 'hbs');
app.set('views', path.join(__dirname, 'views'));
app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
hbsHelpers();
app.use(compression());
app.set('views', path.join(__dirname, 'resources/views'));
app.use(favicon(path.join(__dirname, 'public', 'favicon.png')));
app.use(express.static(path.join(__dirname, 'public')));
app.use(logger('dev'));
app.use(bodyParser.json());
Expand All @@ -38,36 +41,26 @@ app.use(session(
saveUninitialized: false,
store: store,
cookie: {
httpOnly: true, maxAge: 2419200000
httpOnly: true,
maxAge: (typeof settings.cookie.maxAge !== 'undefined')? settings.cookie.maxAge : 2419200000
}
}
)
);

/**
* Module Response
* Init Middleware.
*/
app.use(response());
middleware(app);

/**
* Init Passaport
*/
app.use(passport.initialize());
app.use(passport.session());
passportStrategies(passport);

/**
* Module Auth
*/
policies(app);

/**
* Initialize Routes
* Initialize Routes.
*/
routes(app);

/**
* error handler
* Error handler.
*/
app.use(function (err, req, res, next) {
res.status(err.status || 500);
Expand Down
21 changes: 21 additions & 0 deletions app/helpers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

/**
* Helpers for Handlebars.
*
* Example:
* {{ foo }} or {{ ucfirst variable }}
*
* More documentation:
* http://handlebarsjs.com/expressions.html#helpers,
* https://github.com/barc/express-hbs
*/
var hbs = require('express-hbs'),
ucfirst = require('./ucfirst');

module.exports = function () {

// Make a string's first character uppercase.
ucfirst();

};
17 changes: 17 additions & 0 deletions app/helpers/ucfirst.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

var hbs = require('express-hbs');

module.exports = function () {
/**
* Make a string's first character uppercase.
*
* @param str
* @returns {string}
*/
hbs.registerHelper('ucfirst', function (str) {
var f = str.charAt(0)
.toUpperCase();
return f + str.substr(1);
});
};
Loading