coolony / kiwi

Simple yet powerful asynchronous JavaScript template engine based on jQuery Template syntax, usable server-side or client-side.
MIT License
41 stars 6 forks source link

cannot make it work with express 3.1.2 #26

Closed josecanciani closed 11 years ago

josecanciani commented 11 years ago

oops, there was an error: TypeError: Property 'engine' of object # is not a function

What am I doing wrong? Thanks!!!!

(coffeescript syntax):

express = require('express')
kiwi = require('kiwi')

app = express()
app.set('views', __dirname + '/html')
app.engine('kiwi', kiwi.__express)
app.set('view engine', 'kiwi')

app.get('/', (request, response) ->
    response.send('hello world by express')
)

app.get('/console', (request, response) ->
    response.render('console.html', {}, (err, rendered) ->
        if err
            response.send('oops, there was an error: ' + err)
        else
            response.send('rendered: ' + rendered)
    )
)

app.listen(4000)
```javascript
josecanciani commented 11 years ago

Nevermind, I just found out what it was. I was going to close my computer a go to sleep when I came across another template engine and noticed that app.engine('kiwi'... was actually the file extension to associate. Changed that to .html and worked fine. Thanks and sorry for the premature question :)