0

I've been following a tutorial for building an auth app with admin roles using the MEAN technologies and passport, he used jade as a template engine, I tried to work with simple html5 but there is a specific property of jade that can't be converted, the property is used to bring the user status directly from the backend after a page refresh without an agularJS controller - this is the tutorial github repo : https://github.com/joeeames/MEANAppsFiles

- the jade property is : backend :

app.get('*', function(req, res) {
    res.render('index', {
      bootstrappedUser: req.user
    });
  });
}

- FrontEnd :

if !!bootstrappedUser
  script.
    window.bootstrappedUserObject = !{JSON.stringify(bootstrappedUser)}

Is there a way to use both html and jade or another way to do the user's session persistence after refresh without jade ? Thanks.

1 Answers1

1

You can use MongoDB, NodeJS and Express with Jade without any problem, yes.

The thing about this combination (MEAN combination) is that it completely detaches backend from front end, and since the previous 3 tools are all backend, they can interact with anything you want frontend, including Jade.

The problem is if you can use AngularJS and Jade together. The answer is yes, you can. However, you can also jump from the top of a 1000 meters building (provided no one is stopping you, ofc). Just because you can do something, it doesn't mean you should do it. You can use Jade, but you should probably avoid it (just like you would preferably avoid jumping from the top of a 1000 meters building).

AngularJS (MongoDB, Express, AngularJS, NodeJS - MEAN) is a great tool and you should not need to use Jade with it.

A great discussion on the topic can be seen here:

Community
  • 1
  • 1
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
  • I've been following a tutorial for building an auth app with admin roles, he used jade as a template engine, I tried to work with simple html5 but there is a specific property of jade that can't be converted, the property is used to bring the user status directly from the backend after a page refresh without an agularJS controller - this is the tutorial github repo : https://github.com/joeeames/MEANAppsFiles - the jade property is : backend : app.get('*', function(req, res) { res.render('index', { bootstrappedUser: req.user }); }); } – Hamza Jridi Jun 18 '16 at 10:29