This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>innit.io</title> | |
<!-- Viewport mobile tag for sensible mobile support --> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | |
<!-- |
This file contains 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 util = require('util'); | |
/** | |
* Find Records | |
* |
This file contains 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
/** | |
* AuthenticationController.js | |
* | |
* @description :: | |
* @docs :: http://sailsjs.org/#!documentation/controllers | |
*/ | |
module.exports = { | |
loginForm : function(req,res){ |
This file contains 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
/** | |
* Models | |
* (sails.config.models) | |
* | |
* Unless you override them, the following properties will be included | |
* in each of your models. | |
*/ | |
var uuid = require('node-uuid') |
This file contains 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
//callbacks | |
Foo.find({size : 'large'},function(err,data){ | |
if(err){ //something went wrong} | |
else if(data){ //found some data} | |
else { //no data found} |
This file contains 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
.run(['sails','ngSailsConfig','$location',function (sails,ngSailsConfig,$location) { | |
var launchData = $location.search() | |
sails.lift(ngSailsConfig,launchData) | |
}]) |
This file contains 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
beforeCreate: function(values, done) { | |
if(!values.id){ | |
values.id = uuid.v4(); | |
} | |
done() | |
}, |
This file contains 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.exports.policies = { | |
// Default policy for all controllers and actions | |
// (`true` allows public access) | |
'*': true, | |
// Here's an example of adding some policies to a controller | |
UserController: { |
This file contains 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
var async = require('async') | |
//async forEach | |
async.forEach(collection,function(item,cb){ | |
//do something async with item | |
item.doSomeThing(function(err){ |
This file contains 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
$stateProvider.state('app.home',{ | |
controller : 'HomeController', | |
templateUrl : 'templates/home.html', | |
url : '/', | |
policies : ['authenticated'] | |
}) |