user376456 user376456 - 5 months ago 12
AngularJS Question

Can express mix html and jade routes?

I want to setup an application where I can write as much html over jade as possible. I don't dislike jade, I just want to write html/angular/node APIs, since I'm learning a lot of technologies at once (angular, node, jade, etc).

I would like to build a skeleton project like the following:

  1. Static (server built pages using jade or html) for SEO (basic business card pages).

  2. angular driven admin area (i.e., that is a single html file with embedded angular views/partials.

Should I just learn jade, or attempt to use this mixed approach? I have the first part (simple jade static pages).


Express is pretty template-agnostic, in that you can choose any templating engine you like. If you want more HTML-style templates, you could use ejs instead of Jade, for instance:

// install ejs first
npm install ejs
// app.js
var express = require('express');
var app     = express();

app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');

app.get('/', function(req, res) {
  res.render('index', { name : 'World' });

// ./views/index.html
<h1>Hello <%= name %>!</h1>
// Output:
<h1>Hello World!</h1>