MEAN

iDelivery- MEAN Stack Application

console.log(‘Hello World’)

Today I’m going to use scaffold enter yeoman generated full stack (Mangodb, Express, Angular and node-js boiler plate code). Trying to understanding the barebones of the project structure.

Let me start with app basic js files: app.js, app.config.js, app.constants.js

app.js:-

import angular from ‘angular’;

//ngCookies provides a convenient wrapper for reading and writing browser //cookies.

import ngCookies from ‘angular-cookies’;

//ngResource Provides interactive service with restful service API’s

import ngResource from ‘angular-resource’;

//ngSanitize provides ability to sanitize potential HTML tokens

//angular-socket-io exposes socketFactory which is an API for instantiating //sockets

import ‘angular-socket-io’;

//angular-ui-Router i s a powerful angular-js routing framework that provides //routing based on statemachine allows to provide multiple views from the //same page.

import uiRouter from ‘angular-ui-router’;

//Native angular js directives for Bootstrap

import uiBootstrap from ‘angular-ui-bootstrap’;

//import routeConfig from app.config.js

import {

routeConfig

from ‘./app.config’

}

//auth.module from components which is app specific

import _Auth from ‘../components/auth/auth.module’;

import account from ‘./account’;

import admin from ‘./admin’;

import navbar from ‘../components/navbar/navbar.component’;

import footer from ‘../components/footer/footer.component’;

import main from ‘./main/main.component’;

import constants from ‘./app.constants’;

import util from ‘../components/util/util.module’;

import socket from ‘../components/socket/socket.service’;

import ‘./app.scss’;

angular.module(‘iDeliveryApp’, [ngCookies, ngResource, ngSanitize, ‘btford.socket-io’, uiRouter, uiBootstrap, _Auth, account, admin, navbar, footer, main, constants, socket, util])

.config(routeConfig)

//Use the run method to register work which should be performed when the //injector is done loading all modules.

.run(function($rootScope, $location, Auth)  {

//Annotation of angular -js https://github.com/olov/ng-annotate

‘ngInject’;

$rootScope.$on(‘$stateChangeStart’, function(event, next)) {

Auth.isLoggedIn(function(loggedIn) {

if (next.authenticate && !loggedIn) {

$location.path(‘/login’);

}

});

});

});