It works!
6 | 7 |You've successfully installed the Sails Framework.
8 | 9 |Sails is a modern, realtime MVC framework for the Node.js platform.
It helps you build apps fast.
12 | Documentation 13 | Changelog 14 |
15 |├── example ├── basic │ ├── api │ │ ├── models │ │ │ ├── .gitkeep │ │ │ └── Todo.js │ │ ├── adapters │ │ │ └── .gitkeep │ │ ├── controllers │ │ │ ├── .gitkeep │ │ │ └── TodoController.js │ │ ├── services │ │ │ └── .gitkeep │ │ └── policies │ │ │ └── authenticated.js │ ├── assets │ │ ├── images │ │ │ └── .gitkeep │ │ ├── linker │ │ │ ├── js │ │ │ │ ├── .gitkeep │ │ │ │ ├── Dog.js │ │ │ │ ├── Body.js │ │ │ │ ├── app.js │ │ │ │ └── sails.io.js │ │ │ ├── styles │ │ │ │ └── .gitkeep │ │ │ └── templates │ │ │ │ ├── .gitkeep │ │ │ │ ├── Cat.html │ │ │ │ ├── About.html │ │ │ │ ├── Home.html │ │ │ │ ├── Body.html │ │ │ │ └── Dog.html │ │ ├── favicon.ico │ │ └── robots.txt │ ├── README.md │ ├── config │ │ ├── locales │ │ │ ├── en.json │ │ │ ├── es.json │ │ │ └── _README.md │ │ ├── i18n.js │ │ ├── bootstrap.js │ │ ├── 404.js │ │ ├── log.js │ │ ├── adapters.js │ │ ├── csrf.js │ │ ├── controllers.js │ │ ├── session.js │ │ ├── 500.js │ │ ├── views.js │ │ ├── policies.js │ │ ├── routes.js │ │ └── sockets.js │ ├── app.js │ ├── views │ │ ├── home │ │ │ └── index.ejs │ │ ├── 404.ejs │ │ └── layout.ejs │ ├── package.json │ ├── .gitignore │ └── Gruntfile.js ├── old │ ├── api │ │ ├── adapters │ │ │ └── .gitkeep │ │ ├── models │ │ │ ├── .gitkeep │ │ │ └── Rainbow.js │ │ ├── services │ │ │ └── .gitkeep │ │ ├── controllers │ │ │ ├── .gitkeep │ │ │ └── RainbowController.js │ │ └── policies │ │ │ └── authenticated.js │ ├── assets │ │ ├── images │ │ │ └── .gitkeep │ │ ├── styles │ │ │ ├── .gitkeep │ │ │ └── layout.css │ │ ├── favicon.ico │ │ ├── components │ │ │ ├── Red.js │ │ │ ├── Colors.js │ │ │ ├── Row.js │ │ │ └── Rainbow.js │ │ ├── robots.txt │ │ ├── util.js │ │ ├── mixins │ │ │ └── reset.css │ │ └── index.html │ ├── simple │ │ ├── api │ │ │ ├── models │ │ │ │ └── .gitkeep │ │ │ ├── adapters │ │ │ │ └── .gitkeep │ │ │ ├── controllers │ │ │ │ └── .gitkeep │ │ │ ├── services │ │ │ │ └── .gitkeep │ │ │ └── policies │ │ │ │ └── authenticated.js │ │ ├── assets │ │ │ ├── js │ │ │ │ └── .gitkeep │ │ │ ├── styles │ │ │ │ └── .gitkeep │ │ │ ├── templates │ │ │ │ └── .gitkeep │ │ │ └── mixins │ │ │ │ └── reset.css │ │ ├── public │ │ │ ├── images │ │ │ │ └── .gitkeep │ │ │ ├── favicon.ico │ │ │ ├── robots.txt │ │ │ ├── components │ │ │ │ ├── App.js │ │ │ │ └── Nav.js │ │ │ └── index.html │ │ ├── README.md │ │ ├── config │ │ │ ├── views.js │ │ │ ├── locales │ │ │ │ └── english.js │ │ │ ├── bootstrap.js │ │ │ ├── assets.js │ │ │ ├── local.ex.js │ │ │ ├── session.js │ │ │ ├── policies.js │ │ │ ├── io.js │ │ │ ├── application.js │ │ │ ├── adapters.js │ │ │ └── routes.js │ │ ├── app.js │ │ ├── package.json │ │ ├── views │ │ │ ├── layout.ejs │ │ │ ├── 404.ejs │ │ │ ├── 500.ejs │ │ │ └── home │ │ │ │ └── index.ejs │ │ └── .gitignore │ ├── README.md │ ├── config │ │ ├── views.js │ │ ├── locales │ │ │ └── english.js │ │ ├── bootstrap.js │ │ ├── local.js │ │ ├── local.ex.js │ │ ├── session.js │ │ ├── policies.js │ │ ├── io.js │ │ ├── application.js │ │ ├── adapters.js │ │ └── routes.js │ ├── app.js │ ├── package.json │ ├── views │ │ ├── layout.ejs │ │ ├── 404.ejs │ │ ├── 500.ejs │ │ └── home │ │ │ └── index.ejs │ └── Gruntfile.js └── .gitignore ├── lib ├── Comet.js ├── Data.js ├── ready.js ├── Router.js ├── Framework.js ├── Logger.js ├── define.js ├── touch.js ├── README.md ├── Region.js ├── raise.js ├── Util.js └── deps │ └── _.js ├── .gitignore ├── .editorconfig ├── example.html ├── LICENSE.md ├── Gruntfile.js └── package.json /example/basic/api/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/api/adapters/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/api/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/api/services/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/basic/api/adapters/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/basic/api/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/basic/api/services/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/basic/assets/images/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/api/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/assets/images/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/assets/styles/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/simple/api/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/simple/assets/js/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/basic/assets/linker/js/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/basic/assets/linker/styles/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/simple/api/adapters/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/simple/api/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/simple/api/services/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/simple/assets/styles/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/simple/public/images/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/basic/assets/linker/templates/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/old/simple/assets/templates/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/basic/README.md: -------------------------------------------------------------------------------- 1 | # basic 2 | ### a Sails application -------------------------------------------------------------------------------- /example/old/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | ### a Sails application -------------------------------------------------------------------------------- /example/old/simple/README.md: -------------------------------------------------------------------------------- 1 | # simple 2 | ### a Sails application -------------------------------------------------------------------------------- /example/basic/config/locales/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "Hello": "Sup" 3 | } 4 | -------------------------------------------------------------------------------- /example/basic/config/locales/es.json: -------------------------------------------------------------------------------- 1 | { 2 | "Hello": "Hola" 3 | } 4 | -------------------------------------------------------------------------------- /example/old/config/views.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'viewEngine': 'ejs' 3 | }; -------------------------------------------------------------------------------- /example/old/simple/config/views.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 'viewEngine': 'ejs' 3 | }; -------------------------------------------------------------------------------- /example/old/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/mast/2.x/example/old/assets/favicon.ico -------------------------------------------------------------------------------- /example/basic/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tkh44/mast/2.x/example/basic/assets/favicon.ico -------------------------------------------------------------------------------- /example/basic/assets/linker/templates/Cat.html: -------------------------------------------------------------------------------- 1 |
Description goes here...
4 |Other stuff here probably
4 | 5 | Next -------------------------------------------------------------------------------- /example/basic/assets/linker/templates/Home.html: -------------------------------------------------------------------------------- 1 |Description goes here...
5 | 6 | 25 |
7 | <%= error %>
8 |
9 |
10 | <% }) %>
11 |
12 |
13 |
--------------------------------------------------------------------------------
/example/old/simple/views/500.ejs:
--------------------------------------------------------------------------------
1 |
7 | <%= error %>
8 |
9 |
10 | <% }) %>
11 |
12 |
13 |
--------------------------------------------------------------------------------
/example/old/config/routes.js:
--------------------------------------------------------------------------------
1 | // Routes
2 | // *********************
3 | //
4 | // This table routes urls to controllers/actions.
5 | //
6 | // If the URL is not specified here, the default route for a URL is: /:controller/:action/:id
7 | // where :controller, :action, and the :id request parameter are derived from the url
8 | //
9 | // If :action is not specified, Sails will redirect to the appropriate action
10 | // based on the HTTP verb: (using REST/Backbone conventions)
11 | //
12 | // GET: /:controller/read/:id
13 | // POST: /:controller/create
14 | // PUT: /:controller/update/:id
15 | // DELETE: /:controller/destroy/:id
16 | //
17 | // If the requested controller/action doesn't exist:
18 | // - if a view exists ( /views/:controller/:action.ejs ), Sails will render that view
19 | // - if no view exists, but a model exists, Sails will automatically generate a
20 | // JSON API for the model which matches :controller.
21 | // - if no view OR model exists, Sails will respond with a 404.
22 | //
23 | module.exports.routes = {
24 |
25 |
26 | // If you want to set up a route only for a particular HTTP method/verb
27 | // (GET, POST, PUT, DELETE) you can specify the verb before the path:
28 | // 'post /signup': {
29 | // controller : 'user',
30 | // action : 'signup'
31 | // }
32 |
33 | // Keep in mind default routes exist for each of your controllers
34 | // So if you have a UserController with an action called "juggle"
35 | // a route will be automatically exist mapping it to /user/juggle.
36 | //
37 | // Additionally, unless you override them, new controllers will have
38 | // create(), find(), findAll(), update(), and destroy() actions,
39 | // and routes will exist for them as follows:
40 | /*
41 |
42 | // Standard RESTful routing
43 | // (if index is not defined, findAll will be used)
44 | 'get /user': {
45 | controller : 'user',
46 | action : 'index'
47 | },
48 | 'get /user/:id': {
49 | controller : 'user',
50 | action : 'find'
51 | },
52 | 'post /user': {
53 | controller : 'user',
54 | action : 'create'
55 | },
56 | 'put /user/:id': {
57 | controller : 'user',
58 | action : 'update'
59 | },
60 | 'delete /user/:id': {
61 | controller : 'user',
62 | action : 'destroy'
63 | }
64 | */
65 | };
66 |
--------------------------------------------------------------------------------
/example/old/simple/config/routes.js:
--------------------------------------------------------------------------------
1 | // Routes
2 | // *********************
3 | //
4 | // This table routes urls to controllers/actions.
5 | //
6 | // If the URL is not specified here, the default route for a URL is: /:controller/:action/:id
7 | // where :controller, :action, and the :id request parameter are derived from the url
8 | //
9 | // If :action is not specified, Sails will redirect to the appropriate action
10 | // based on the HTTP verb: (using REST/Backbone conventions)
11 | //
12 | // GET: /:controller/read/:id
13 | // POST: /:controller/create
14 | // PUT: /:controller/update/:id
15 | // DELETE: /:controller/destroy/:id
16 | //
17 | // If the requested controller/action doesn't exist:
18 | // - if a view exists ( /views/:controller/:action.ejs ), Sails will render that view
19 | // - if no view exists, but a model exists, Sails will automatically generate a
20 | // JSON API for the model which matches :controller.
21 | // - if no view OR model exists, Sails will respond with a 404.
22 | //
23 | module.exports.routes = {
24 |
25 | // To route the home page to the "index" action of the "home" controller:
26 | '/' : {
27 | controller : 'home'
28 | }
29 |
30 | // If you want to set up a route only for a particular HTTP method/verb
31 | // (GET, POST, PUT, DELETE) you can specify the verb before the path:
32 | // 'post /signup': {
33 | // controller : 'user',
34 | // action : 'signup'
35 | // }
36 |
37 | // Keep in mind default routes exist for each of your controllers
38 | // So if you have a UserController with an action called "juggle"
39 | // a route will be automatically exist mapping it to /user/juggle.
40 | //
41 | // Additionally, unless you override them, new controllers will have
42 | // create(), find(), findAll(), update(), and destroy() actions,
43 | // and routes will exist for them as follows:
44 | /*
45 |
46 | // Standard RESTful routing
47 | // (if index is not defined, findAll will be used)
48 | 'get /user': {
49 | controller : 'user',
50 | action : 'index'
51 | },
52 | 'get /user/:id': {
53 | controller : 'user',
54 | action : 'find'
55 | },
56 | 'post /user': {
57 | controller : 'user',
58 | action : 'create'
59 | },
60 | 'put /user/:id': {
61 | controller : 'user',
62 | action : 'update'
63 | },
64 | 'delete /user/:id': {
65 | controller : 'user',
66 | action : 'destroy'
67 | }
68 | */
69 | };
70 |
--------------------------------------------------------------------------------
/example/basic/assets/linker/js/app.js:
--------------------------------------------------------------------------------
1 | /**
2 | * app.js
3 | *
4 | * This file contains some conventional defaults for working with Socket.io + Sails.
5 | * It is designed to get you up and running fast, but is by no means anything special.
6 | *
7 | * Feel free to change none, some, or ALL of this file to fit your needs!
8 | */
9 |
10 |
11 | (function (io) {
12 |
13 | // as soon as this file is loaded, connect automatically,
14 | var socket = io.connect();
15 | if (typeof console !== 'undefined') {
16 | log('Connecting to Sails.js...');
17 | }
18 |
19 | socket.on('connect', function socketConnected() {
20 |
21 | // Listen for Comet messages from Sails
22 | socket.on('message', function messageReceived(message) {
23 |
24 | ///////////////////////////////////////////////////////////
25 | // Replace the following with your own custom logic
26 | // to run when a new message arrives from the Sails.js
27 | // server.
28 | ///////////////////////////////////////////////////////////
29 | log('New comet message received :: ', message);
30 | //////////////////////////////////////////////////////
31 |
32 | });
33 |
34 |
35 | ///////////////////////////////////////////////////////////
36 | // Here's where you'll want to add any custom logic for
37 | // when the browser establishes its socket connection to
38 | // the Sails.js server.
39 | ///////////////////////////////////////////////////////////
40 | log(
41 | 'Socket is now connected and globally accessible as `socket`.\n' +
42 | 'e.g. to send a GET request to Sails, try \n' +
43 | '`socket.get("/", function (response) ' +
44 | '{ console.log(response); })`'
45 | );
46 | ///////////////////////////////////////////////////////////
47 |
48 |
49 | });
50 |
51 |
52 | // Expose connected `socket` instance globally so that it's easy
53 | // to experiment with from the browser console while prototyping.
54 | window.socket = socket;
55 |
56 |
57 | // Simple log function to keep the example simple
58 | function log () {
59 | if (typeof console !== 'undefined') {
60 | console.log.apply(console, arguments);
61 | }
62 | }
63 |
64 |
65 | })(
66 |
67 | // In case you're wrapping socket.io to prevent pollution of the global namespace,
68 | // you can replace `window.io` with your own `io` here:
69 | window.io
70 |
71 | );
72 |
--------------------------------------------------------------------------------
/example/old/assets/components/Rainbow.js:
--------------------------------------------------------------------------------
1 | Mast.define('Rainbow', function () {
2 |
3 | return {
4 |
5 | '#test': function (x,y,z) {
6 | alert('#test routed successfully! got args:\nx:' + x + '\ny:' + y + '\nz:'+ z);
7 | },
8 |
9 | '#test/:id': function (x,y,z) {
10 | alert('#test/:id routed successfully! got args:\nx:' + x + '\ny:' + y + '\nz:'+ z);
11 | },
12 |
13 | events: {
14 |
15 | 'click .add-thing': function addThing () {
16 | this.collection.create({
17 | color: Mast.randomPastelColor()
18 | });
19 | },
20 |
21 | 'click .remove-thing': function removeFirstThing () {
22 | var model = this.collection.shift();
23 | model.destroy();
24 | },
25 |
26 | 'click .wipe-things': function removeAllThings () {
27 | while (this.collection.length) {
28 | this.collection.at(0).destroy();
29 | }
30 | }
31 | },
32 |
33 | // Doing it this way ensures that this component is bound to a global collection set,
34 | // and if one already exists, it uses it
35 | collection: function () {
36 | return Mast.data.Rainbows;
37 | },
38 |
39 | beforeRender: function (cb) {
40 | // TODO: Loading state
41 | this.collection.fetch({
42 | silent: true,
43 | success: function () {
44 | cb();
45 | }
46 | });
47 | },
48 |
49 | afterRender: function () {
50 | this.collection.trigger('reset', this.collection);
51 | },
52 |
53 | // Standard collection bindings
54 | afterAdd: function (model, collection, options) {
55 |
56 | // Clear empty state
57 | if (this.collection.length > 0) {
58 | this.$('.emptyhtml').fadeOut();
59 | }
60 |
61 | // Render the row in the appropriate place
62 | this.rows.insert(
63 | options.at || collection.length-1,
64 | 'Row', {
65 | model: model
66 | });
67 |
68 | },
69 | afterRemove: function (model, collection, options) {
70 | this.rows.remove(options.at || 0);
71 |
72 | // Empty state
73 | if (this.collection.length < 1) {
74 | this.$('.emptyhtml').fadeIn();
75 | }
76 | },
77 | afterReset: function (collection, options) {
78 | var self = this;
79 |
80 | // Clear empty state
81 | if (this.collection.length > 0) {
82 | this.$('.emptyhtml').fadeOut();
83 | }
84 |
85 | // Flush region and replace w/ new contents
86 | this.rows.empty();
87 | collection.each(function (model) {
88 | self.rows.append('Row', { model: model });
89 | });
90 |
91 | // Empty state
92 | if (this.collection.length < 1) {
93 | this.$('.emptyhtml').fadeIn();
94 | }
95 | }
96 | };
97 | });
--------------------------------------------------------------------------------
/example/basic/config/views.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Views
3 | *
4 | * Server-sent views are a classic and effective way to get your app up and running.
5 | * Views are normally served from controllers, but by default, Sails also exposes routes
6 | * to allow you to preview your views in a browser. This automatic routing can be disabled
7 | * using the `blueprint` config below. You can also configure your templating language/framework
8 | * of choice, and configure Sails' layout support.
9 | *
10 | * For more information on views and layouts, check out:
11 | * http://sailsjs.org/#documentation
12 | */
13 |
14 | module.exports.views = {
15 |
16 | // View engine (aka template language)
17 | // to use for your app's *server-side* views
18 | //
19 | // Sails+Express supports all view engines which implement
20 | // TJ Holowaychuk's `consolidate.js`, including, but not limited to:
21 | //
22 | // ejs, jade, handlebars, mustache
23 | // underscore, hogan, haml, haml-coffee, dust
24 | // atpl, eco, ect, jazz, jqtpl, JUST, liquor, QEJS,
25 | // swig, templayed, toffee, walrus, & whiskers
26 |
27 | engine: 'ejs',
28 |
29 |
30 |
31 | // Layouts are simply top-level HTML templates you can use as wrappers
32 | // for your server-side views. If you're using ejs, you can take advantage of
33 | // Sails' built-in `layout` support.
34 | //
35 | // With using a layout, when one of your views is served, it is injected into
36 | // the <%- body %> partial defined in the layout. This lets you reuse header
37 | // and footer logic between views.
38 | //
39 | // NOTE: Layout support is only implemented for the `ejs` view engine!
40 | // For most other engines, it is not necessary, since they implement
41 | // partials/layouts themselves. In those cases, this config willwill be silently
42 | // ignored.
43 | //
44 | // The `layout` setting may be set to one of:
45 | //
46 | // If `true`, Sails will look for the default, located at `views/layout.ejs`
47 | // If `false`, layouts will be disabled.
48 | // Otherwise, if a string is specified, it will be interpreted as the relative path
49 | // to your layout from `views/` folder.
50 | // (the file extension, e.g. ".ejs", should be omitted)
51 | //
52 |
53 | layout: 'layout'
54 |
55 |
56 |
57 | // Using Multiple Layouts with EJS
58 | //
59 | // If you're using the default engine, `ejs`, Sails supports the use of multiple
60 | // `layout` files. To take advantage of this, before rendering a view, override
61 | // the `layout` local in your controller by setting `res.locals.layout`.
62 | // (this is handy if you parts of your app's UI look completely different from each other)
63 | //
64 | // e.g. your default might be
65 | // layout: 'layouts/public'
66 | //
67 | // But you might override that in some of your controllers with:
68 | // layout: 'layouts/internal'
69 |
70 |
71 | };
--------------------------------------------------------------------------------
/example/basic/views/404.ejs:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
30 | 40 | Why might this be happening? 41 |
42 |
47 |
48 | You've successfully installed the Sails Framework.
8 | 9 |Sails is a modern, realtime MVC framework for the Node.js platform.
It helps you build apps fast.
12 | Documentation 13 | Changelog 14 |
15 |You've successfully installed the Sails Framework.
8 | 9 |Sails is a modern, realtime MVC framework for the Node.js platform.
It helps you build apps fast.
12 | Documentation 13 | Changelog 14 |
15 |