Jade extends not working with express.js

I don't know what I am doing wrong but extend doesn't working in my case.

server.js

var express = require('express');
var mongodb = require('mongodb');
var bodyParser = require('body-parser');
var cookieParser = require('cookie-parser');
var expressSession = require('express-session');


var app = require('express')();
app.use(bodyParser());
app.use(cookieParser());
app.use(expressSession({
    secret: 'moj-sekret'
}));

app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.set('view options', {layout:false});


app.get('/', function(req, res){
   res.render('index', { authenticated: false});
   console.log('index');
});

app.get('/login', function (req, res){
  res.render('login');
  console.log('login'); 
});

app.listen(3000);

example of jade

layout jade

 doctype
 html
   head
     title Przykład MongoDB
   body
     h1 Moja
     hr
     block content

login jade

extends layout
block content

form(action="/login", method="POST")
    fieldset
        legend Logowanie
        p
            label Adres e-mail
            input(name="user[email]", type="text")
        p
            button Wyślij
        p
            a(href="/") Powrót

i use express 4.7.2 and jade 1.9.1 and i dont have any error or bugs when run node

Answers


First of all, your jade file seems to be wrong:

extends layout
block content
    form(action="/login", method="POST")
        fieldset
            legend Logowanie
            p
                label Adres e-mail
                input(name="user[email]", type="text")
            p
                button Wyślij
            p
                a(href="/") Powrót 

There might be something else as well, but try this first.


Need Your Help

Why this text comparision fails?

java android android-edittext equals

I am trying to get the text in the EditText component named textfield and see if it equals "facebook". It does not work though and I can't for the life of me find out why. Also in the if statement ...

Why did Java make package access default?

java unit-testing encapsulation access-modifiers testability

I'm asking this question because I believe they did it for a very good reason and that most people do not use it properly, well from my experience in industry so far anyway. But if my theory is tru...