Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
mendezcode committed Sep 6, 2012
1 parent 745881f commit 4c2fec8
Show file tree
Hide file tree
Showing 110 changed files with 35 additions and 44,272 deletions.
77 changes: 34 additions & 43 deletions app/views/main/main-guide.html
Expand Up @@ -115,12 +115,12 @@

View Partials are created with the `protos partial` command. It uses the same convention as the views:

$ protos view blog/post admin/sidebar
$ protos partial blog/post admin/sidebar

Here's the output of the command above:

» Created myapp/app/views/blog/_post.html
» Created myapp/app/views/admin/_sidebar.html
» Created myapp/app/views/blog/partials/post.html
» Created myapp/app/views/admin/partials/sidebar.html

As with views, you can also specify the `--ext` option to create your partials using custom extensions.

Expand Down Expand Up @@ -214,7 +214,7 @@
$ protos
Usage: protos [action] [arguments]

Actions: [create, server, deploy, fetch, inspector] [controller, helper, model, view, partial, static]
Actions: [create, install, server, deploy, fetch, inspector, lint] [controller, helper, model, view, partial, static]

--domain Domain to attach the application to (create)
--css Bundle client side CSS frameworks (create)
Expand Down Expand Up @@ -242,7 +242,7 @@

For documentation, refer to http://derdesign.github.com/protos/

protos@0.0.4 /usr/local/lib/node_modules/protos
protos@0.1.0 /Users/der/Node/projects/protos

If you did not install the framework globally, you can access the `protos(1)` command by running `bin/protos` inside the
framework's directory.
Expand All @@ -251,15 +251,15 @@
## Deploying a Cluster Server

Protos provides a built-in proxy that will automatically direct requests for all your applications. Behind the scenes,
it uses the [Bouncy](https://github.com/substack/bouncy) to handle the redirection.
it uses [Bouncy](https://github.com/substack/bouncy) to handle the redirection.

You can deploy your applications & servers using the command line or a JSON file.


### Using the commmand line

Each application runs in a separate node process, isolated from other applications. This is a secure deployment strategy,
to prevent collisions between your applications & libraries.
to prevent collisions between your applications & libraries.

Applications can define how many **node processes** they will use in their respective `multiProcess` bootstrap option.
This way, you can manually specify how many cores each application will use.
Expand Down Expand Up @@ -342,22 +342,21 @@
├── boot.js
├── config
│   ├── base.js
│   ├── database.js
│   ├── drivers.js
│   ├── env
│   │   ├── debug.js
│   │   ├── development.js
│   │   └── production.js
│   ├── regex.js
│   └── storage.js
│   └── storages.js
├── data
│   └── readme.md
├── hooks
│   └── init.js
├── incoming
│   └── readme.md
├── init.js
├── lib
│   ├── application.js
│   ├── request.js
│   └── response.js
│   └── application.js
├── log
├── middleware
│   └── readme.md
Expand All @@ -366,8 +365,7 @@
│   ├── favicon.ico
│   └── robots.txt
├── scripts
│   ├── automate.js
│   └── readme.md
│   └── sample.js
└── test
└── readme.md

Expand All @@ -379,10 +377,6 @@
The bootstrap file is very flexible, since it also allows you to run code on each environment. Useful if you want to
load different middleware configurations on each environment.

### init.js

The function in this file gets executed _after_ the application initializes (and after the `init` event).

### package.json

Package information for the application. If you remove this file, make sure you include an `index.js` file, which will
Expand All @@ -395,7 +389,7 @@
- **controllers**: Contains controller files
- **helpers**: Contains helper files
- **models**: Contains model files
- **views**: Contain view & layout files
- **views**: Contain view & layout files

### app/views

Expand Down Expand Up @@ -431,6 +425,11 @@
Any kind of data related to the application. This directory has been included for convenience purposes. You can store any
type of scripts and/or information here.

### hooks/

This directory is used to store the application hooks. These are files that contain code to be run on specific application
events. The filename determines in which event the code will run.

### incoming/

Directory to hold File Uploads. This is the upload location for the [Body Parser Middleware](middleware.html#body_parser).
Expand Down Expand Up @@ -472,9 +471,9 @@
The configuration files are stored in the config/ directory. Here's an explanation on what each file contains:

- **base.js**: Base application configuration, directly accessed via `app.config`
- **database.js**: Settings related to the databases.
- **drivers.js**: Driver configuration settings
- **regex.js**: Regular Expressions to be used by the application
- **storage.js**: Settings related to the storages
- **storages.js**: Storage configuration settings
- **env/**: Holds scripts for each environment

Each file you add into the config/ directory, will be added as a property of the `app.config` object. You can access
Expand Down Expand Up @@ -541,7 +540,7 @@
This file is used to start your application. It is very slim and can do lots of things. It is automatically provided to you
when creating your applications. Here's what it looks like:

var Protos = require('../');
var Protos = require('protos');

Protos.bootstrap(__dirname, {

Expand All @@ -550,10 +549,10 @@

// Server configuration
server: {
host: '0.0.0.0',
host: 'localhost',
port: 8080,
multiProcess: false,
stayUp: false
stayUp: 'production'
},

// Application environments
Expand Down Expand Up @@ -586,8 +585,6 @@

});

module.exports = protos.app;

Here's a detailed explanation of the several configuration sections:

### Application Configuration
Expand Down Expand Up @@ -1049,7 +1046,7 @@

function MainController(app) {

this.authFilter(function(req, res, promise) {
this.filter(function(req, res, promise) {
if (req.queryData.pass === '1234') promise.emit('success');
else res.rawHttpMessage(403, true);
});
Expand All @@ -1076,14 +1073,14 @@

There are a few important things to know about Controller Filters to be able to use them at full potential:

- You add them by doing `this.authFilter(callback)` from within any controller
- A Controller can have multiple authentication filters by running `this.authFilter` multiple times.
- You add them by doing `this.filter(callback)` from within any controller
- A Controller can have multiple authentication filters by running `this.filter` multiple times.
- The _Filter Callback_ runs in the _Controller's Context_
- The _Filter Callback_ receives three parameters: _request_, _response_ and _promise_
- If validation succeeded, you emit the `success` event on the promise
- If validation fails, you need to send a response manually

### Auth Filters & Sessions
### Filters & Sessions

When using the [Sessions Middleware](middleware.html#session), it automatically provides a authentication filter for you, which
deeply integrates with both the controller and your application.
Expand Down Expand Up @@ -1314,11 +1311,10 @@
Important things to know about view partials:

- Are exposed as local functions within your views
- Can be located anywhere within the controller's _views directory_ path
- Can be located anywhere within the *__layout* directory path
- Their filenames should start with an underscore
- Are located within the *partials/* directory, directly inside the view path
- The view extension determines the template engine to be used
- Partial functions *must* receive the *locals* object as argument
- Partial functions *should* receive a *locals* object as argument

To learn to create view partials, refer to the [Creating View Partials](#creating-application-resources_creating-view-partials) section.

Expand All @@ -1344,22 +1340,17 @@
<tbody>
<tr>
<td></td>
<td> main/_partial.html </td>
<td> main/partials/partial.html </td>
<td> main_partial</td>
</tr>
<tr>
<td></td>
<td> blog/post/_comment.html </td>
<td> blog_post_comment</td>
</tr>
<tr>
<td></td>
<td> __layout/_sidebar.html </td>
<td> __layout/sidebar.html </td>
<td> layout_sidebar</td>
</tr>
<tr>
<td></td>
<td> __layout/widget/_rss.html </td>
<td> __layout/widget/rss.html </td>
<td> layout_widget_rss</td>
</tr>
<tr>
Expand Down Expand Up @@ -1435,7 +1426,7 @@

- **$sanitize**: _Sanitizes input_
- **$escape**: _Escapes input_
- **$safe_str_**: _Sanitizes &amp; Escapes input_
- **$safestr**: _Sanitizes &amp; Escapes input_

### Accessing View Helpers

Expand Down
2 changes: 1 addition & 1 deletion public/css/main.less
Expand Up @@ -46,7 +46,7 @@ h6 { font-size: @minHeading; }
h2 a, h3 a { color: @bodyColor; }
h2 a:hover, h3 a:hover { text-decoration: none; }

@blockquoteColor: #ffcd1c;
@blockquoteColor: lighten(#ffcd1c, 4%);

blockquote {
background: lighten(@blockquoteColor, 35%); margin: 0; padding: 10px; margin-bottom: @lineHeight; .border-radius(4px);
Expand Down

0 comments on commit 4c2fec8

Please sign in to comment.