0

I'm struggling to perform routing using Express in the ng-boilerplate structure.

I'd like to do it using HTML view files (as opposed to JADE).

Can anyone help provide examples of how to do this?

I keep getting Failed to lookup view xx errors when using app.get('/', function(req, res){ res.render('index'); });

MikroDel
  • 6,705
  • 7
  • 39
  • 74
manihiki
  • 682
  • 2
  • 12
  • 22

1 Answers1

0

Try to set your views directory:

var express = require('express');
var app = express();

app.configure(function() { 
        app.use(express.static(__dirname + '/public'));
        app.set('views', __dirname + '/views');  // <=== Where your HTML view files are present
        app.set('view engine', 'jade'); //Your view engine to be set here
    });

For detailed information:

Community
  • 1
  • 1
Amol M Kulkarni
  • 21,143
  • 34
  • 120
  • 164
  • This isn't quite what I wanted, since the code you gave uses jade as a view engine, but I got something working with ejs doing something similar to what you suggested. Thanks! – manihiki Sep 18 '13 at 04:02
  • @manihiki Actually I commented in my answer like `//Your view engine to be set here` so you can use any template engines. Nice to see my answer help you yo solve issue in some way.. Happy coding & exploring.. :) – Amol M Kulkarni Sep 18 '13 at 12:38