Permalink
Browse files

Updating documentation with detail on how to add and use custom Expre…

…ss middleware, currently undocumented
  • Loading branch information...
1 parent 04dca80 commit 678dc696d42e2be5c3081526509a6de28c9cad57 @robskillington robskillington committed Aug 5, 2013
Showing with 22 additions and 0 deletions.
  1. +19 −0 config.express.md
  2. +3 −0 config.md
View
19 config.express.md
@@ -0,0 +1,19 @@
+# Express
+This configuration file lets you easily add [Express](http://expressjs.com/) middleware, local variables and helpers for templates and directly access the application instance before it starts.
+
+```javascript
+module.exports.express = {
+
+ customMiddleware: false
+
+ /*
+ // Say you want to use `connect-flash` for messaging within a session
+ customMiddleware: function (app) {
+ var flash = require('connect-flash');
+ app.use(flash());
+ }
+
+ */
+
+};
+```
View
3 config.md
@@ -19,6 +19,9 @@
####[CSRF](https://github.com/balderdashy/sails-wiki/blob/0.9/config.csrf.md)
>When enabled, all non-GET requests to the Sails server must be accompanied by a special token, identified as the '_csrf' parameter.
+####[Express](https://github.com/balderdashy/sails-wiki/blob/0.9/config.express.md)
+>If you want to use custom middleware or add local variables and helpers to templates you can do so by configuring express in this config file.
+
####[Local](https://github.com/balderdashy/sails-wiki/blob/0.9/config.local.md)
>While you’re developing your app, this config file should include any settings specifically for your development computer (db passwords, etc.)

0 comments on commit 678dc69

Please sign in to comment.