This file contains hidden or 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
In MEAN data is collected and communicated in the package and it goes through the different layers of angular, express and mongo. | |
The data "moves" "up the stack" from the angular view to the controller and then the service and from then to an express route a controller and model schema which is used to save the object in the db. | |
We'll use the create.html from the articles core package to demonstrate this. |
This file contains hidden or 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
config | |
├── assets.json | |
├── config.js | |
├── env | |
│ ├── all.js | |
│ ├── development.js | |
│ ├── production.js | |
│ └── test.js | |
├── express.js | |
├── passport.js |
This file contains hidden or 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
'use strict'; | |
angular.module('mean').controller('ArticlesController', ['$scope', '$stateParams', '$location', 'Global', 'Articles', | |
function($scope, $stateParams, $location, Global, Articles) { | |
$scope.global = Global; | |
$scope.hasAuthorization = function(article) { | |
if (!article || !article.user) return false; | |
return $scope.global.isAdmin || article.user._id === $scope.global.user._id; | |
}; |
This file contains hidden or 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
├── README.md | |
├── app.js | |
├── package.json | |
├── public | |
│ ├── assets | |
│ │ ├── css | |
│ │ │ └── sonar.css | |
│ │ └── img | |
│ │ └── logo.png | |
│ ├── controllers |
This file contains hidden or 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
{ | |
"name": "mean", | |
"description": "MEAN.io: A fullstack javascript platformed powerd by MongoDB, ExpressJS, AngularJS, NodeJS.", | |
"version": "0.3.3", | |
"private": false, | |
"author": "Linnovate <[email protected]>", | |
"contributors": [ | |
{ "name": "Lior Kesos", "mail": "[email protected]" }, | |
{ "name": "Yonatan Ellman", "mail": "[email protected]" }, | |
{ "name": "Ehud Shahak", "mail": "[email protected]" }, |
This file contains hidden or 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
<section data-ng-controller="InstallationsController"> | |
<form name="articleForm" class="form-horizontal col-md-6" role="form" data-ng-submit="articleForm.$valid && create()" novalidate> | |
<div class="form-group"> | |
<label mean-token="'create-title'" class="col-md-3 control-label">Title</label> | |
<div class="col-md-9"> | |
<input type="text" class="form-control" data-ng-model="title" id="title" placeholder="Title" required> | |
</div> | |
</div> | |
<div class="form-group"> | |
<label mean-token="'create-content'" for="content" class="col-md-3 control-label">Content</label> |
This file contains hidden or 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
/** | |
* Module dependencies. | |
*/ | |
var mongoose = require('mongoose'), | |
async = require('async'), | |
_ = require('underscore'); | |
exports.render = function(req, res) { | |
if (req.user) { |
This file contains hidden or 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
/** | |
* Module dependencies. | |
*/ | |
var express = require('express'), | |
fs = require('fs'), | |
passport = require('passport'), | |
logger = require('mean-logger'); |
This file contains hidden or 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
#!/bin/bash | |
curl --silent --write-out '%{http_code}\n' "http://israelhayom.co.il/api/v2/getItems?class_id=1&format=json&order_by=popular&debug=static&real=1" |
This file contains hidden or 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
$(document).ready(function() { | |
$.get("/0.1/user", function(data) { | |
window.user = data.user; | |
window.online = true; | |
window.bootstrap(); | |
}).fail(function(jqXHR, textStatus, errorThrown) { | |
var userString = localStorage.getItem('ls.localUser'); | |
window.user = JSON.parse(userString); | |
window.online = false; |