Permalink
Browse files

Examples & Usage added.

  • Loading branch information...
1 parent 4e700a2 commit 4d84b280752cee98284de6105bbc17716b509f33 @quangv committed Feb 5, 2012
Showing with 114 additions and 0 deletions.
  1. +71 −0 Readme.md
  2. +14 −0 example/simple.coffee
  3. +28 −0 example/simple.js
  4. +1 −0 example/views/simple.hulk
View
71 Readme.md
@@ -8,6 +8,77 @@ Hi {{name}}
{{> salute}}
```
+# Usage
+
+_views/index.hulk_
+
+```mustache
+Hello {{what}}!
+```
+
+__CoffeScript__
+
+_app.coffee_
+
+```coffee
+ express = require 'express'
+ hulk = require 'hulk-hogan'
+
+ app = express.createServer()
+
+ app.set 'views', __dirname+'/views' # Directory of your views
+ app.set 'view options', layout:false
+ app.set 'view engine', 'hulk' # use the .hulk file extensions for your views
+ app.register '.hulk', hulk # register to render .hulk with Hulk-Hogan
+
+ app.get '/', (req,res)->
+ res.render 'index', {what:'World'}
+
+ app.listen 3000
+```
+
+`coffee app.coffee` would produce: _http://localhost:3000_
+
+> Hello World!
+
+__JavaScript__
+
+_app.js_
+
+```javascript
+ var app, express, hulk;
+
+ express = require('express');
+
+ hulk = require('hulk-hogan');
+
+ app = express.createServer();
+
+ app.set('views', __dirname + '/views');
+
+ app.set('view options', {
+ layout: false
+ });
+
+ app.set('view engine', 'hulk');
+
+ app.register('.hulk', hulk);
+
+ app.get('/', function(req, res) {
+ res.render('index', {
+ what: 'World'
+ });
+ });
+
+ app.listen(3000);
+
+```
+
+
+`node app.js` would produce: _http://localhost:3000_
+
+> Hello World!
+
# Others
Hulk-Hogan inspired by [HBS](https://github.com/donpark/hbs)
View
14 example/simple.coffee
@@ -0,0 +1,14 @@
+express = require 'express'
+hulk = require '../'
+
+app = express.createServer()
+
+app.set 'views', __dirname+'/views'
+app.set 'view options', layout:false
+app.set 'view engine', 'hulk'
+app.register '.hulk', hulk
+
+app.get '/', (req,res)->
+ res.render 'simple', {hello:'world'}
+
+app.listen 3000
View
28 example/simple.js
@@ -0,0 +1,28 @@
+(function() {
+ var app, express, hulk;
+
+ express = require('express');
+
+ hulk = require('../');
+
+ app = express.createServer();
+
+ app.set('views', __dirname + '/views');
+
+ app.set('view options', {
+ layout: false
+ });
+
+ app.set('view engine', 'hulk');
+
+ app.register('.hulk', hulk);
+
+ app.get('/', function(req, res) {
+ return res.render('simple', {
+ hello: 'world'
+ });
+ });
+
+ app.listen(3000);
+
+}).call(this);
View
1 example/views/simple.hulk
@@ -0,0 +1 @@
+{{hello}}, What's up?!?

0 comments on commit 4d84b28

Please sign in to comment.