Loading repository data…
Loading repository data…
4LOOPph / repository
4LOOP MEAN - Full-Stack JavaScript Using MySQL/MariaDB, Express, AngularJS, and Node.js
4LOOP MEAN is a framework for an easy starting point with MySQL / MariaDB, Node.js, Express, and AngularJS based applications. It is designed to give you a quick and organized way to start developing MEAN based web apps with useful modules pre-bundled and configured.
If you're using ubuntu, this is the preferred repository to use...
$ curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
$ sudo apt-get update
$ sudo apt-get install nodejs
$ npm install -g gulp
// and bower
$ npm install -g bower
To start with MEAN
$ npm install
$ bower install
$ node index
http://localhost:3000
If you have a node, or other MEAN project already running, you may need to use a different port. You can set the port and start your new MEAN project with one command:
$ export PORT=3001 && node index
Then, open a browser and change the port number before you visit:
http://localhost:3001
During installation depending on your os and prerequisite versions you may encounter some issues.
Most issues can be solved by one of the following tips, but if you are unable to find a solution feel free to contact us via the repository issue tracker or the links provided below.
Sometimes you may find there is a weird error during install like npm's Error: ENOENT. Usually updating those tools to the latest version solves the issue.
$ npm update -g npm
$ npm update -g gulp
$ npm update -g bower
NPM and Bower has a caching system for holding packages that you already installed. We found that often cleaning the cache solves some troubles this system creates.
$ npm cache clean
$ bower cache clean
Some of Mean.io dependencies uses node-gyp with supported Python version 2.7.x. So if you see an error related to node-gyp rebuild follow next steps:
$ npm update -g
If you get this error when trying to mean init:
Prerequisite not installed: git
And you definitely have Git for Windows installed, then it's not included in your path. Find the folder containing git.exe (likely C:\Program Files (x86)\Git\cmd) and add it to your PATH.
MEAN is an acronym for MySQL/MariaDB , Express.js , Angular.js and Node.js
The file structure is similar to that of the MEAN project itself
Fundamental Files at the root of the package
Server
Packages are registered in the app.js
Defines package name, version and mean=true in the package.json
All of the Server side code resides in the /app directory.
app
--- controllers # Server side logic goes here
--- daos # Database Active Objects (Database Queries logic goes here)
--- routes # Rest api endpoints for routing
--- views # Swig based html rendering
All of the Server side configuration resides in the /config directory.
config # Configuration files
--- environment # node environment
All of the API documentation resides in the /docs directory.
docs
--- api # swagger json file
Client
All of the Client side code resides in the /public directory.
There are 2 types for Client side setup:
1.)
public
--- assets # JavaScript/CSS/Images (not aggregated)
--- controllers # Angular controllers
--- config # Contains routing files
--- services # Angular services (also directive and filter folders)
--- views # Angular views
2.)
public
--- assets # CSS/Images (not aggregated)
--- scripts
---- services # Angular services
---- directives # Angular directives
---- filters # Angular filters
---- config # Contains main routing files
--- modules # Angular views and controllers
---- (feature)foldername
----- feature.html # Angular View
----- feature.modal.html # Angular View
----- feature.config.js # Contains routing files
----- controllers # Angular controllers
----- feature.controller.js
All the configuration is specified in the config folder, through the env files, and is orchestrated through the meanio NPM module. Here you will need to specify your application name, database name, and hook up any social app keys if you want integration with Twitter, Facebook, GitHub, or Google.
To run with a different environment, just specify NODE_ENV:
$ NODE_ENV=test node index
or :
$ node index test
Before you start make sure you have the Heroku toolbelt installed.
Add the db string to the production env in server/config/env/production.js.
Create heroku app (if needed)
$ git init
$ git add .
$ git commit -m "initial version"
$ heroku apps:create
If you get missing module errors, install missing dependencies
npm i -S ms kerberos
npm update --save
git commit -m "save versions to package.json"
Push to heroku and configure
$ git push heroku master
$ heroku config:set NODE_MODULES_CACHE=false
$ heroku config:set NODE_ENV=production
$ heroku config:set CPU_COUNT=2
You can adjust the CPU_COUNT variable up or down based on how much memory your app is consuming, or leave it unset to fork a process for each CPU.
We believe that MEAN should be free and easy to integrate within your existing projects so we chose The MIT License