mozilla/nunjucks — pull request #242 by gillesfabio (2014-06-13 11:44:20+00:00)
Title: Express: add index view support.

This PR :

* Move Express-related code to `src/express.js`
* Add Express index view support ([see](https://github.com/visionmedia/express/blob/master/lib/view.js#L62))
* Add `tests/express-sample/views/indexview` folder
* Add `tests/express-sample/views/indexview/index.html` file
* Add a new test in `tests/express/express.js`

Example.

Let's create a folder `views/blog` and `views/blog/index.html`.

Then to render the view:

```js
app.get('/blog', function(req, res) {
res.render('blog'); // same as 'blog/index' or 'blog/index.html'
});
```

It's the default Express behavior.

Tell me if you rather prefer to keep the Express-related code into `src/environment.js`.

I'm not sure I correctly use environment's `loaders`. I just iterate over them and their `searchPaths` property to check the index file existence. It's maybe (probably?) not the right way.