Skip to content

Instantly share code, notes, and snippets.

@sailsinaction
Last active April 8, 2016 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sailsinaction/1d1d3abd3326407aecf2 to your computer and use it in GitHub Desktop.
Save sailsinaction/1d1d3abd3326407aecf2 to your computer and use it in GitHub Desktop.
Chapter 8 - Gists
.d8888b. 888 888 .d8888b. .d8888b. d8b 888
d88P Y88b 888 888 d88P Y88b d88P Y88b Y8P 888
888 888 888 888 Y88b. d88P 888 888 888
888 88888b. 8888b. 88888b. 888888 .d88b. 888d888 "Y88888" 888 888 .d8888b 888888 .d8888b
888 888 "88b "88b 888 "88b 888 d8P Y8b 888P" .d8P""Y8b. 888 88888 888 88K 888 88K
888 888 888 888 .d888888 888 888 888 88888888 888 888 888 888888 888 888 888 "Y8888b. 888 "Y8888b.
Y88b d88P 888 888 888 888 888 d88P Y88b. Y8b. 888 Y88b d88P Y88b d88P 888 X88 Y88b. X88
"Y8888P" 888 888 "Y888888 88888P" "Y888 "Y8888 888 "Y8888P" "Y8888P88 888 88888P' "Y888 88888P'
888
888
888
/**
* Route Mappings
* (sails.config.routes)
*
* Your routes map URLs to views and controllers.
*
* If Sails receives a URL that doesn't match any of the routes below,
* it will check for matching files (images, scripts, stylesheets, etc.)
* in your assets directory. e.g. `http://localhost:1337/images/foo.jpg`
* might match an image file: `/assets/images/foo.jpg`
*
* Finally, if those don't match either, the default 404 handler is triggered.
* See `api/responses/notFound.js` to adjust your app's 404 logic.
*
* Note: Sails doesn't ACTUALLY serve stuff from `assets`-- the default Gruntfile in Sails copies
* flat files from `assets` to `.tmp/public`. This allows you to do things like compile LESS or
* CoffeeScript for the front-end.
*
* For more information on configuring custom routes, check out:
* http://sailsjs.org/#!/documentation/concepts/Routes/RouteTargetSyntax.html
*/
module.exports.routes = {
/***************************************************************************
* *
* Make the view located at `views/homepage.ejs` (or `views/homepage.jade`, *
* etc. depending on your default view engine) your home page. *
* *
* (Alternatively, remove this and add an `index.html` file in your *
* `assets` directory) *
* *
***************************************************************************/
'GET /': {
view: 'homepage'
},
'GET /videos': {
view: 'videos',
locals: {
me: {
id: 1,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com'
}
}
},
'GET /profile': {
view: 'profile',
locals: {
me: {
id: 1,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com',
username: 'sails-in-action'
}
}
},
'GET /edit-profile': {
view: 'edit-profile',
locals: {
me: {
id: 1,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com',
username: 'sails-in-action'
}
}
},
'GET /signup': {
view: 'signup',
locals: {
me: {
id: null,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com'
}
}
},
'GET /restore-profile': {
view: 'restore-profile',
locals: {
me: {
id: null,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com'
}
}
},
'GET /administration': {
view: 'adminUsers',
locals: {
me: {
id: 1,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com',
}
}
}
/***************************************************************************
* *
* Custom routes here... *
* *
* If a request to a URL doesn't match any of the custom routes above, it *
* is matched against Sails route blueprints. See `config/blueprints.js` *
* for configuration options and examples. *
* *
***************************************************************************/
};
<!DOCTYPE html>
<html>
<head>
<title>New Sails App</title>
<!-- Viewport mobile tag for sensible mobile support -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--STYLES-->
<link rel="stylesheet" href="/styles/angular-toastr.css">
<link rel="stylesheet" href="/styles/bootstrap.min.css">
<link rel="stylesheet" href="/styles/importer.css">
<!--STYLES END-->
<script type="text/javascript">
window.SAILS_LOCALS = {
me: {
id: null
}
};
</script>
</head>
<body ng-app="brushfire">
<%- partial('./partials/navigation.ejs') %>
<%- body %>
<!--TEMPLATES-->
<script type="text/javascript" src="/jst.js"></script>
<!--TEMPLATES END-->
<!--SCRIPTS-->
<script src="/js/dependencies/sails.io.js"></script>
<script src="/js/dependencies/angular.js"></script>
<script src="/js/dependencies/angular-route.min.js"></script>
<script src="/js/dependencies/angular-toastr.js"></script>
<script src="/js/dependencies/angular-toastr.tpls.js"></script>
<script src="/js/dependencies/compareTo.module.js"></script>
<script src="/js/dependencies/jquery-1.11.2.min.js"></script>
<script src="/js/dependencies/jquery.min.js"></script>
<script src="/js/dependencies/lodash.js"></script>
<script src="/js/dependencies/ng-pattern-restrict.js"></script>
<script src="/js/app.js"></script>
<script src="/js/controllers/adminUsersPageController.js"></script>
<script src="/js/controllers/editProfilePageController.js"></script>
<script src="/js/controllers/homePageController.js"></script>
<script src="/js/controllers/navPageController.js"></script>
<script src="/js/controllers/profilePageController.js"></script>
<script src="/js/controllers/restorePageController.js"></script>
<script src="/js/controllers/signupPageController.js"></script>
<script src="/js/controllers/videosPageController.js"></script>
<!--SCRIPTS END-->
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>New Sails App</title>
<!-- Viewport mobile tag for sensible mobile support -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!--STYLES-->
<link rel="stylesheet" href="/styles/angular-toastr.css">
<link rel="stylesheet" href="/styles/bootstrap.min.css">
<link rel="stylesheet" href="/styles/importer.css">
<!--STYLES END-->
<script type="text/javascript">
window.SAILS_LOCALS = {
me: <%- JSON.stringify(me||null) %>
};
</script>
</head>
<body ng-app="brushfire">
<%- partial('./partials/navigation.ejs') %>
<%- body %>
<!--TEMPLATES-->
<script type="text/javascript" src="/jst.js"></script>
<!--TEMPLATES END-->
<!--SCRIPTS-->
<script src="/js/dependencies/sails.io.js"></script>
<script src="/js/dependencies/angular.js"></script>
<script src="/js/dependencies/angular-route.min.js"></script>
<script src="/js/dependencies/angular-toastr.js"></script>
<script src="/js/dependencies/angular-toastr.tpls.js"></script>
<script src="/js/dependencies/compareTo.module.js"></script>
<script src="/js/dependencies/jquery-1.11.2.min.js"></script>
<script src="/js/dependencies/jquery.min.js"></script>
<script src="/js/dependencies/lodash.js"></script>
<script src="/js/dependencies/ng-pattern-restrict.js"></script>
<script src="/js/app.js"></script>
<script src="/js/controllers/adminUsersPageController.js"></script>
<script src="/js/controllers/editProfilePageController.js"></script>
<script src="/js/controllers/homePageController.js"></script>
<script src="/js/controllers/navPageController.js"></script>
<script src="/js/controllers/profilePageController.js"></script>
<script src="/js/controllers/restorePageController.js"></script>
<script src="/js/controllers/signupPageController.js"></script>
<script src="/js/controllers/videosPageController.js"></script>
<!--SCRIPTS END-->
</div>
</body>
</html>
/**
* Route Mappings
* (sails.config.routes)
*
* Your routes map URLs to views and controllers.
*
* If Sails receives a URL that doesn't match any of the routes below,
* it will check for matching files (images, scripts, stylesheets, etc.)
* in your assets directory. e.g. `http://localhost:1337/images/foo.jpg`
* might match an image file: `/assets/images/foo.jpg`
*
* Finally, if those don't match either, the default 404 handler is triggered.
* See `api/responses/notFound.js` to adjust your app's 404 logic.
*
* Note: Sails doesn't ACTUALLY serve stuff from `assets`-- the default Gruntfile in Sails copies
* flat files from `assets` to `.tmp/public`. This allows you to do things like compile LESS or
* CoffeeScript for the front-end.
*
* For more information on configuring custom routes, check out:
* http://sailsjs.org/#!/documentation/concepts/Routes/RouteTargetSyntax.html
*/
module.exports.routes = {
/***************************************************************************
* *
* Make the view located at `views/homepage.ejs` (or `views/homepage.jade`, *
* etc. depending on your default view engine) your home page. *
* *
* (Alternatively, remove this and add an `index.html` file in your *
* `assets` directory) *
* *
***************************************************************************/
'GET /': {
view: 'homepage',
locals: {
me: {
id: 1,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com'
}
}
},
'GET /videos': {
view: 'videos',
locals: {
me: {
id: 1,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com'
}
}
},
'GET /profile': {
view: 'profile',
locals: {
me: {
id: 1,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com',
username: 'sails-in-action'
}
}
},
'GET /edit-profile': {
view: 'edit-profile',
locals: {
me: {
id: 1,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com',
username: 'sails-in-action'
}
}
},
'GET /signup': {
view: 'signup',
locals: {
me: {
id: null,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com'
}
}
},
'GET /restore-profile': {
view: 'restore-profile',
locals: {
me: {
id: null,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com'
}
}
},
'GET /administration': {
view: 'adminUsers',
locals: {
me: {
id: 1,
gravatarURL: 'http://www.gravatar.com/avatar/ef3eac6c71fdf24b13db12d8ff8d1264?',
email: 'sailsinaction@gmail.com',
}
}
}
/***************************************************************************
* *
* Custom routes here... *
* *
* If a request to a URL doesn't match any of the custom routes above, it *
* is matched against Sails route blueprints. See `config/blueprints.js` *
* for configuration options and examples. *
* *
***************************************************************************/
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment