I am building a website with nodejs & express.
I originally come from the .net world, building sites with MVC / Razor.
Is there a way to insert server side code into a view using nodejs/express ?
In my head i'm thinking of something similar to what I can do in a asp.net mvc view, like this :
<div class='user-info'>
<%= Db.FetchUserById(1).Name %>
</div>
Well, you have A LOT of options. Check this list : https://github.com/joyent/node/wiki/modules#wiki-templating
The one have heard of the most is Jade : http://jade-lang.com/ I think.
Mustache is what you are looking for.
It works with Express aswell. Here is a quick guide on how to push your objects to the view.
Take a look at ejs, I think it has similar syntax.
https://github.com/visionmedia/ejs
you can start building an express application with --ejs ( i.e express --ejs) to include it as template engine.